[llvm-bugs] [Bug 49775] New: missed optimization for dead code elimination at -O3 (vs. -O2)

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 30 10:52:39 PDT 2021


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

            Bug ID: 49775
           Summary: missed optimization for dead code elimination at -O3
                    (vs. -O2)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: zhendong.su at inf.ethz.ch
                CC: llvm-bugs at lists.llvm.org

[582] % clangtk -v
clang version 13.0.0 (https://github.com/llvm/llvm-project.git
9fb0025f7084db14d16fe5cbe1d799f4ee0020af)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/suz-local/opfuzz/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0
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/7.5.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
[583] % 
[583] % clangtk -O2 -S -o O2.s small.c
[584] % clangtk -O3 -S -o O3.s small.c
[585] % 
[585] % wc O2.s O3.s
  32   76  770 O2.s
 147  415 2958 O3.s
 179  491 3728 total
[586] % 
[586] % grep foo O2.s
[587] % grep foo O3.s
        callq   foo
[588] % 
[588] % cat small.c
extern void foo(void);
static int b, c, *d = &b, *e = &b;
char *f;
int h;
static void g() { b = h; }
int main() {
  int i = 0;
  while (i < 2)
    i++;
  if (!(i ^ *e)) {
    foo();
    g();
    for (c = 0; c < 50; c++)
      *f = 0;
  }
  *d = 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/20210330/2eff55d6/attachment.html>


More information about the llvm-bugs mailing list