[X86] Improve optimizeCompareInstr for signed comparisons after BMI/TBM instructions
authorCraig Topper <craig.topper@sifive.com>
Wed, 31 Mar 2021 16:41:02 +0000 (09:41 -0700)
committerCraig Topper <craig.topper@sifive.com>
Wed, 31 Mar 2021 16:45:29 +0000 (09:45 -0700)
commit50b8634a99b6f2f36a3fdbea7aa7892c9b881d64
treeee65fc785cfba4d11466ee52958bfce7364ba85a
parent563cdeaafd5812cb90656380a8f9d6b85d2abf08
[X86] Improve optimizeCompareInstr for signed comparisons after BMI/TBM instructions

We previously couldn't optimize out a TEST if the branch/setcc/cmov
used the overflow flag. This patches allows the TEST to be removed
if the flag producing instruction is known to clear the OF flag.
Thats what the TEST instruction would have done so that should be
equivalent.

Need to add test cases. I'll try to get back to this if I have bandwidth.

Fixes PR48768.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D94856
llvm/lib/Target/X86/X86InstrInfo.cpp
llvm/test/CodeGen/X86/bmi.ll
llvm/test/CodeGen/X86/tbm_patterns.ll