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: [email protected]
          Reporter: [email protected]
                CC: [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to