https://bugs.llvm.org/show_bug.cgi?id=51321

            Bug ID: 51321
           Summary: [DAGCombine] wrong result on -O3 -fuse-ld=lld
                    -flto=full
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: AArch64
          Assignee: unassignedb...@nondot.org
          Reporter: zhongyu...@tom.com
                CC: arnaud.degrandmai...@arm.com,
                    llvm-bugs@lists.llvm.org, smithp...@googlemail.com,
                    ties.st...@arm.com

base on the newest commit 41cedb1c, dag combine generate wrong code with the
attached test code. we expect the the run result is `c=1,h=49`, while now is
`c=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://g...@gitlab.huawei.com:2222/boole-compiler/llvm-project
41cedb1c9a380628ac162bf76148cbd143f41450)

======= 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;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to