-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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 while cross-compiling Servo for ARM #32049
Comments
I posted this issue. I had to delete my old account. |
You can see this by compiling the image crate version 0.7. Note that it only reproduces targeting arm32 (as shown above), not aarch64 or any of our x86_64 linux/osx/windows targets. cc @eddyb, whom we chatted with about this a bit in #servo |
Could someone who already has this set up run |
The last 10k lines: |
Full file will be available here shortly: |
|
Reduced this. (Originally .bc weighed over 5 MB.) Clone https://github.com/sanxiyn/image/tree/reduce and:
|
@sanxiyn Awesome work - thanks for doing this! It would have taken me a lot longer, and I probably wouldn't have gotten it down so far. |
Minimized further: https://gist.github.com/alexcrichton/f7b527d749f1784508b1 Not... sure what to learn from that |
@alexcrichton The challenge is to get clang to trip the same assert, to prove it's a LLVM bug and have it reported upstream. |
I understand it's a cross-compilation-only bug as it definitely doesn't reproduce natively. |
@petevine Is there a way to check if it's a 64-bit -> 32-bit issue? That's the first thing that jumps to mind. |
Not sure what you meant by that. One more thing, the crates used here seem to be the official armv6 ones, whereas I'm using a natively built armv7 compiler so maybe there's some mixing of |
@petevine I mean, cross-compiling for |
No, if the cross-tools are not mismatched then there shouldn't be an issue. But they could be in the armv6/v7 department. |
@petevine That's not what I mean. This is a bug inside LLVM, which means it could be very well be some host/target type-size dissonance. |
No one here mentioned an EDIT: |
This does not reproduce for
|
@sanxiyn What's the diff between the completely unoptimized IR of those two targets? |
@sanxiyn @eddyb The |
This reproduces on |
@petevine The only way this was going to be an ARM-specific issue (which is it not) is either a very strange |
Thanks and sorry for the false lead. |
@petevine Np, just trying to speed this up, because it looks like a bad bug that could otherwise remain unfixed for a few more years (especially if it's IR a C compiler would never generate). |
Since @sanxiyn didn't post it, here's their diff showing the alignment difference, made after passing both inputs through rustfilt.sh (otherwise the random symbol names introduce a lot of noise). |
What's the status here? We just hit this again: http://build.servo.org/builders/arm32/builds/1329/steps/compile/logs/stdio |
Although it's possible I misunderstood him, @eddyb suggested to me that this was an LLVM bug -- which I guess means we may need to consider trying to find a workaround? |
The workaround in the other issue(s) is to not use |
@nikomatsakis Since this is tied to alignment, finding a LlVM target for |
@alexcrichton's reduced test case reproduces on 2016-03-18 but not on 2016-03-20, and 2016-03-19 doesn't exist, which gives us this range. EDIT: Great, that's #32080, which probably changed the resulting IR in subtle ways. |
I can confirm that #33872 is what broke Servo recently. I wonder if fixing that "the right" way (i.e. with EDIT: clang behavior: https://godbolt.org/g/EphFuK vs https://godbolt.org/g/5dikH9 |
Always generating a |
trans: always use a memcpy for ABI argument/return casts. When storing incoming arguments or values returned by call/invoke, always do a `memcpy` from a temporary of the cast type, if there is an ABI cast. While Clang has gotten smarter ([store](https://godbolt.org/g/EphFuK) vs [memcpy](https://godbolt.org/g/5dikH9)), a `memcpy` will always work. This is what @dotdash has wanted to do all along, and it fixes #32049.
The profile_csv3 branch compiles successfully on a Mac OS X 10.10 and on a 64-bit Ubuntu 14.04. However, while cross-compiling the profile_csv3 branch for ARM (following instructions here: https://github.com/servo/servo-nightly/blob/master/.travis.yml) using the arm-linux-gnueabihf toolchain on an Ubuntu (14.04/15.10) host, I get the following error:
rustc: /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:531: void {anonymous}::PromoteMem2Reg::run(): Assertion
isAllocaPromotable(AI) && "Cannot promote non-promotable alloca!"' failed. Aborted (core dumped) Build failed, waiting for other jobs to finish... Could not compile
image`.Servo branch: https://github.com/larsbergstrom/servo/tree/profile_csv3
Environment variables set:
BUILD_TARGET=arm-unknown-linux-gnueabihf
TRIPLET=arm-linux-gnueabihf
PKG_CONFIG_ALLOW_CROSS=1
PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig
EXPAT_NO_PKG_CONFIG=1
FREETYPE2_NO_PKG_CONFIG=1
FONTCONFIG_NO_PKG_CONFIG=1
CC=arm-linux-gnueabihf-gcc
CXX=arm-linux-gnueabihf-g++
PATH="$PATH:$HOME/bin"
The text was updated successfully, but these errors were encountered: