[llvm-bugs] [Bug 33954] New: Performance regression with rrL308142

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 26 13:53:35 PDT 2017


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

            Bug ID: 33954
           Summary: Performance regression with rrL308142
           Product: tools
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: llc
          Assignee: unassignedbugs at nondot.org
          Reporter: anna at azul.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 18851
  --> https://bugs.llvm.org/attachment.cgi?id=18851&action=edit
IR file to run with llc

With rL308142, there was an optimization introduced to convert cmov to branches
when profitable.

We noticed couple of regressions (around 2-5%) on skylake hardware on internal
benchmarks. The performance was back to normal when -x86-cmov-converter=false
was supplied.

I've tried to reduce the IR as much as possible, and added a main method along
with it. However, the regression (using time command) is not quite visible,
seems to be attributed to noise.

I've attached the IR and how the assembly is generated. Perhaps something may
jump out wrt the heuristics, which seems to be having a performance cliff: we
convert a cmov to branch when the gain is greater than 25% of misprediction
penalty.


Reproduce as:
llc -mcpu=skylake
-mattr=+sse2,+cx16,+prfchw,+bmi2,+xsavec,+fsgsbase,+popcnt,+aes,+xsaves,+mmx,+rdseed,+clflushopt,+xsave,+avx,+rtm,+fma,+bmi,+rdrnd,+sse4.1,+sse4.2,+avx2,+sse,+lzcnt,+pclmul,+f16c,+ssse3,+sgx,+cmov,+movbe,+xsaveopt,+adx,+sse3,
-O3 -x86-cmov-converter=false test.ll ; mv test.s test.falsenative.s; gcc
test.falsenative.s -o test.falsenative

llc -mcpu=skylake
-mattr=+sse2,+cx16,+prfchw,+bmi2,+xsavec,+fsgsbase,+popcnt,+aes,+xsaves,+mmx,+rdseed,+clflushopt,+xsave,+avx,+rtm,+fma,+bmi,+rdrnd,+sse4.1,+sse4.2,+avx2,+sse,+lzcnt,+pclmul,+f16c,+ssse3,+sgx,+cmov,+movbe,+xsaveopt,+adx,+sse3,
-O3 -x86-cmov-converter=true test.ll ; mv test.s test.truenative.s; gcc
test.truenative.s -o test.truenative

echo "time for x86-cmov-converter=true"
time ./test.truenative > chk2 

echo "time for x86-cmov-converter=false" 
time ./test.falsenative > chk 

time for x86-cmov-converter=true

real    0m0.155s
user    0m0.065s
sys     0m0.007s
time for x86-cmov-converter=false

real    0m0.154s
user    0m0.064s
sys     0m0.008s

-- 
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/20170726/9cc5a944/attachment.html>


More information about the llvm-bugs mailing list