[LLVMbugs] [Bug 19157] New: Bad O2,O3 optimization in some cases

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Mar 16 16:22:04 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19157

            Bug ID: 19157
           Summary: Bad O2,O3 optimization in some cases
           Product: new-bugs
           Version: 3.3
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: kostya27 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

I have two almost similar programs 1.bc and 2.bc which generated by crystal:
https://gist.github.com/kostya/c1748e5dde4aefa4cb14

and perfomance for both should be the same, but:

/usr/lib/llvm-3.3/bin/opt 1.bc -o 1.obc -O3 && /usr/lib/llvm-3.3/bin/llc 1.obc
-o 1.s && gcc -c 1.s -o 1.o && gcc  1.o -o 1 -lm -lpcre -lgc -lrt -lunwind &&
./1
1.42804

/usr/lib/llvm-3.3/bin/opt 2.bc -o 2.obc -O3 && /usr/lib/llvm-3.3/bin/llc 2.obc
-o 2.s && gcc -c 2.s -o 2.o && gcc  2.o -o 2 -lm -lpcre -lgc -lrt -lunwind &&
./2
0.321645

1.bc 4.4 times slower than 2.bc with O3.

But if i add: -scalarrepl -instcombine, it became the same:

/usr/lib/llvm-3.3/bin/opt 1.bc -o 1.obc -O3 -scalarrepl -instcombine &&
/usr/lib/llvm-3.3/bin/llc 1.obc -o 1.s && gcc -c 1.s -o 1.o && gcc  1.o -o 1
-lm -lpcre -lgc -lrt -lunwind && ./1
0.310694

/usr/lib/llvm-3.3/bin/opt 2.bc -o 2.obc -O3 -scalarrepl -instcombine &&
/usr/lib/llvm-3.3/bin/llc 2.obc -o 2.s && gcc -c 2.s -o 2.o && gcc  2.o -o 2
-lm -lpcre -lgc -lrt -lunwind && ./2
0.317292

-- 
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/20140316/24bf748c/attachment.html>


More information about the llvm-bugs mailing list