[llvm-bugs] [Bug 49171] New: Instcombine infinite combine loop with -O3

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Feb 13 06:52:57 PST 2021


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

            Bug ID: 49171
           Summary: Instcombine infinite combine loop with -O3
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: haoxintu at gmail.com
                CC: llvm-bugs at lists.llvm.org

Hi, all.

This code, s.c, is a valid program but makes Clang hung on with -O3 at compile
time.

$cat s.c
int a, b, c, d;
void e() {
  a = 7;
  for (; a <= 78; a++) {
    d = 3;
    for (; d <= 73; d++) {
      int f = 0;
      b += c;
      if (b) {
        int g = 0;
        for (f = 5; f; g)
          ;
      }
    }
  }
}

$clang -c -w -O3 s.c
//endless compiling

This problem only occurs in clang-trunk with -O3, and other released versions
or optimization flags seem well while dealing with this case.

$clang -v
clang version 13.0.0 (https://github.com/llvm/llvm-project
48bdd676a1d1338c10541460bf5beb69ac17e451)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir:
/home/haoxin/haoxin-data/dut-research/compilers/llvm-project/build-20210127/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Candidate multilib: .;@m64
Selected multilib: .;@m64

Thanks.
Haoxin

-- 
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/20210213/502a2ee1/attachment.html>


More information about the llvm-bugs mailing list