Emit pass - LLVM ERROR - 64-bit code requested on a subtarget that doesn't support it
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
LLVM Version: `20.1.5`
In my compiler, in case the user hasn't provided a target triple or CPU name or CPU features, I ask LLVM for the host's CPU name and CPU features.
In my case, the values are as follows:
CPU Name: `znver3`
CPU Features: `prfchw`, `avx`, `aes`, `sahf`, `pclmul`, `crc32`, `xsaves`, `sse4.1`, `xsave`, `sse4.2`, `invpcid`, `64bit`, `xsavec`, `cmov`, `movbe`, `adx`, `avx2`, `vpclmulqdq`, `clflushopt`, `bmi`, `sse`, `xsaveopt`, `rdrnd`, `cx8`, `sse3`, `pku`, `fsgsbase`, `clzero`, `mwaitx`, `lzcnt`, `sha`, `wbnoinvd`, `ssse3`, `cx16`, `bmi2`, `fma`, `popcnt`, `f16c`, `rdpru`, `clwb`, `mmx`, `sse2`, `rdseed`, `rdpid`, `shstk`, `vaes`, `fxsr`, `sse4a`
I am using `llvm::sys::getHostCPUName` and `llvm::sys::getHostCPUFeatures` to retrieve the above information.
When I run the emit pass, the following error occurs:
```log
LLVM ERROR: 64-bit code requested on a subtarget that doesn't support it!
```
I tried skipping the `64bit` CPU feature to check what happens. I get the following error in one of the IR functions:
```log
error: :0:0:
in function std:float_to_string:[f64] %"std::String" (double):
SSE register return with SSE disabled
```
Contributor guide
Research direction
Start by tracing llvm::sys::getHostCPUName and llvm::sys::getHostCPUFeatures into the emit pass, using the reported znver3 features and both LLVM errors as the reproduction. Determine where the host target and subtarget assumptions diverge; done means the cause and a focused fix or regression test are identified.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100