-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
PowerPC: Rust test fails when optimized for power9 #83362
Comments
@llvm/issue-subscribers-backend-powerpc Author: Josh Stone (cuviper)
Here is my test case extracted from a Rust LTO build: [reduced.bc.gz](https://github.com/llvm/llvm-project/files/14441197/reduced.bc.gz)
(originally from the rust `image` crate at version 0.23.14)
We ran into a test failure in an EPEL build for CentOS Stream 9 ppc64le, which has LLVM 17.0.6. For the purpose of this report, I am using LLVM main as of commit d1f0444. The test works fine (prints "ok") with the default CPU:
However, with
At @nikic's suggestion, I tried the optimized build with I was also trying to reduce the testcase further with llvm-reduce, but I think it quickly got into UB, because even when I verified with an |
llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Lines 14927 to 14953 in 3246c44
|
I can confirm that deleting that block lets the original Rust crate pass its tests as well. |
Created #84892 to fix this. The reason of the bug is: when combining load with int-to-fp, we missed replacing uses of previous load's chain with new one. Thus following memory operations may become unordered. // Compile with -mcpu=power9
void foo(unsigned char *a, long b) {
double x = (double)a[0] - 1.28e2;
double y = (double)a[8] - 1.28e2;
*((double*)a) = y;
*((double*)(a+8)) = x;
} For above C code, compiler (wrongly) schedules first store before second load: lxsibzx 0, 0, 3
mr 4, 3
stfdu 0, 8(4)
lxsibzx 0, 0, 4 |
/cherry-pick e5b20c8 |
/pull-request #85648 |
Update to LLVM 18.1.2 Fixes rust-lang#122476. Also contains fixes for Rahix/avr-hal#505 and llvm/llvm-project#83362. r? `@cuviper`
Here is my test case extracted from a Rust LTO build: reduced.bc.gz
(originally from the rust
image
crate at version 0.23.14)We ran into a test failure in an EPEL build for CentOS Stream 9 ppc64le, which has LLVM 17.0.6. For the purpose of this report, I am using LLVM main as of commit d1f0444.
The test works fine (prints "ok") with the default CPU:
However, with
-mcpu=power9
, it fails at-O1
:At @nikic's suggestion, I tried the optimized build with
-debug-counter=dagcombine-count=0
, and that ran fine. Then I usedbisect-skip-count
to narrow the failure to-debug-counter=dagcombine-skip=1463229,dagcombine-count=201
. I hope that's a small enough range that someone who knows dagcombine and/or powerpc better can inspect the problem!I was also trying to reduce the testcase further with llvm-reduce, but I think it quickly got into UB, because even when I verified with an
-O0
build, that got into the weeds where the same build would sometimes print "ok" and sometimes crash.The text was updated successfully, but these errors were encountered: