Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Not bug. Performance. Loop optimization. clang++ 1.6x slower than g++ #49270

Open Quuxplusone opened 3 years ago

Quuxplusone commented 3 years ago
Bugzilla Link PR50301
Status NEW
Importance P enhancement
Reported by Grigory Vasilyev (h0tc0d3@gmail.com)
Reported on 2021-05-11 06:37:28 -0700
Last modified on 2021-05-11 06:40:23 -0700
Version 12.0
Hardware PC Linux
CC htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments fib.cpp (914 bytes, text/x-c++src)
Blocks
Blocked by
See also
Created attachment 24850
Affected C++ Source

It this case https://pastebin.com/rhpWvssR

g++ -O2 fib.cpp -o /tmp/fib;clang++ -O2 -fdiagnostics-color=always fib.cpp -o
/tmp/fib2;/tmp/fib;/tmp/fib2

GCC Execution time: 37.622s
Clag Execution time: 61.858s

With OMP and little bit change algo

GCC Execution time: ~23s
Clag Execution time: ~38s

GCC Version 10.2.0
LLVM 11.1.0 and 12.0.0 git branch

This also happens in more complex code. I simplified code for minimal
instructions.
Quuxplusone commented 3 years ago

Attached fib.cpp (914 bytes, text/x-c++src): Affected C++ Source

Quuxplusone commented 3 years ago
I also rechecked time /tmp/fib;time /tmp/fib2
Maybe g++ cheating std::chrono::high_resolution_clock::now
But no, the results are the same.