Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLVM Error with "+soft-float": "Do not know how to split the result of this operator" #92760

Open
phip1611 opened this issue Jan 11, 2022 · 3 comments
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-target-feature Area: Enabling/disabling target features like AVX, Neon, etc. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@phip1611
Copy link

phip1611 commented Jan 11, 2022

I can't compile the fontdue-crate because it fails with: LLVM ERROR: Do not know how to split this operator's operand!

I compile it with: cargo rustc -- -C target-feature=+soft-float,-sse,-sse2,-x87 --emit=llvm-ir

This happens with different compiler versions, independent of stable or nightly versions. I tested to build the dependencies of fontdue without problems, therefore I think Rustc/LLVM runs into a bug because of the code from fontdue.

LLVM IR

The two LLVM IR files I found after the build can be found on Google Drive.

@phip1611 phip1611 added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 11, 2022
@phip1611 phip1611 changed the title LLVM Error with "soft-float": Do not know how to split the result of this operator LLVM Error with "+soft-float": Do not know how to split the result of this operator Jan 11, 2022
@phip1611 phip1611 changed the title LLVM Error with "+soft-float": Do not know how to split the result of this operator LLVM Error with "+soft-float": "Do not know how to split the result of this operator" Jan 11, 2022
@hkratz
Copy link
Contributor

hkratz commented Jan 11, 2022

@phip1611 Quick question: Why do you use +soft-float with +x87? What do you expect floating-point code to be compiled to?

@phip1611
Copy link
Author

phip1611 commented Jan 11, 2022

Sorry, typo I made here on GitHub. It's -x87 @hkratz

@nikic nikic added the A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. label Jan 11, 2022
@phip1611
Copy link
Author

phip1611 commented Jan 12, 2022

Update See below

In the meantime, I found out that the problem originates in hashbrown-dependency and not fontdue.

Not when building the library but when building an executable, that uses it. Minimal example:

fn main() {
    let _book_reviews = hashbrown::HashMap::<(), ()>::new();
}

Compiled with $ cargo rustc --bin bug -- -C target-feature=+soft-float,-sse,-sse2,-x87

To be exact, I'm using fontdue [-> hashbrown] in a no_std executable, that gets built with the build-std-feature of cargo. The compiler target there uses the specified CPU features from above, which should get applied to the crate itself, all dependencies, and the core library. The example above is just my minimal reproducible example.

Update
Together with the maintainer of hashbrown I figured out that the usage of RUSTFLAGS="-C target-feature=... in fact solves the problem for hashbrown because this way also dependencies are built with the requested flags. But it still doesn't solve the build problem for fontdue.

In my build setup where I originally found the issue I don't use RUSTFLAGS but a custom compiler target json file. I created a minimal reproducible example similar to my setup: https://github.com/phip1611/rust-llvm-bug-20220112-minimal-example

Update 2
When I disable the simd-feature of the latest fontdue version (which is on GitHub, not on crates.io yet!) and use that as dependency, I'm running into this error: #62729 The workaround proposed there is working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-target-feature Area: Enabling/disabling target features like AVX, Neon, etc. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants