[llvm-bugs] [Bug 37912] New: Clang-cl inefficient assembly, 'inc' not generated
llvm-bugs at lists.llvm.org
Sat Jun 23 05:04:13 PDT 2018
Bug ID: 37912
Summary: Clang-cl inefficient assembly, 'inc' not generated
OS: Windows NT
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: jvapen at gmail.com
CC: llvm-bugs at lists.llvm.org
Unfortunately, I am unable to share all details for this.
However in investigating why the generated executable by clang-cl is 10% slower
than the one of MSVC, I did notice the following already when comparing the
MSVC uses specialized inc/dec instructions while clang uses add instructions:
MSVC: incq 0x20(%rbx)
Clang: addq $0x1,(%rcx)
MSVC: inc %rcx
Clang: add $0x1,%rdx
MSVC: dec %eax
Clang: add $0xffffffff,%edi
File was compiled with:
clang-cl.exe -fms-compatibility-version=19.11 /DBOOST_USE_WINDOWS_H
-Weverything -Wno-unused-command-line-argument /nologo /c /W4 /Wall /wd4710
/wd4711 /GR /EHsc /favor:INTEL64 /fp:precise /FS /std:c++17 /Ox /Z7 /MD
Note that /favor:INTEL64 ain't recognized by clang, which might be the reason
the inc instruction doesn't get selected.
At the same time, it is remarkable that for most functions, more non-volotile
registers get pushed/popped by clang than by MSVC. In the hot path, I've
noticed 8 pop instructions for clang and 3 for MSVC.
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-bugs