[llvm-bugs] [Bug 51321] New: [DAGCombine] wrong result on -O3 -fuse-ld=lld -flto=full

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 3 06:45:11 PDT 2021


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: unassignedbugs at nondot.org
          Reporter: zhongyunde at tom.com
                CC: arnaud.degrandmaison at arm.com,
                    llvm-bugs at lists.llvm.org, smithp352 at googlemail.com,
                    Ties.Stuij at 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://git@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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210803/1bde341d/attachment-0001.html>


More information about the llvm-bugs mailing list