-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
[DAGCombine] wrong result on -O3 -fuse-ld=lld -flto=full #50663
Comments
I originally thought you meant 41cedb1 caused this, but that wouldn't make much sense for a AArch64 bug. I believe this transform needs a one use check on the Add it is transforming:
|
Yes, the Operand N0 has multi uses t46: i32 = add t45, Constant:i32<65535> |
Can you post the IR for this example, so I'm sure I have the right test? Note: if I remove that entire block of code, no regression tests fail. My 'blame' skills aren't good - can anyone tell what the motivating case for this transform looked like? If we don't have one, then we can just delete the code. |
the Total DAG showed as following, and also welcome some advice on https://reviews.llvm.org/D107692 after your investigation, thanks. (gdb) p DAG.dump() |
Added test: And minimal bug fix: Marking as candidate for 13.0 release. |
Merged: 9b3867e |
mentioned in issue #51489 |
Extended Description
base on the newest commit 41cedb1, dag combine generate wrong code with the attached test code. we expect the the run result is
c=1,h=49
, while now isc=0,h=49
, and disable the optimization of DAGCombiner::visitANDLike can get expected right result.clang -mcpu=tsv110 -O3 -fuse-ld=lld -Wall issue.c -save-temps
~/llvm-project-upstream(main) » install/bin/clang -v
Huawei Bisheng Compiler clang version 14.0.0 (ssh://git@gitlab.huawei.com:2222/boole-compiler/llvm-project 41cedb1)
======= test case =========
int printf(const char *, ...);
static int c = 2, d;
short g, h;
int main() {
g ^= 50; // 50
c = 0 || g; // 1
h = g - 1; // 49
d = h & 1; // 1
c &= d; // 1
printf("c=%d,h=%d\n", c, h);
// CHECK-RESULT: c=1,h=49
return 0;
}
The text was updated successfully, but these errors were encountered: