diff options
author | Matthias Braun <matthiasb@fb.com> | 2021-09-27 15:21:15 -0700 |
---|---|---|
committer | Matthias Braun <matthiasb@fb.com> | 2021-10-28 10:33:56 -0700 |
commit | 97a1570d8c31dc3bff12dd77b1ee824e1872bb69 (patch) | |
tree | 69e59b4d1ace57722f49a7cb766ef882b0fa7040 /llvm/lib/CodeGen/TwoAddressInstructionPass.cpp | |
parent | e50f02ba7ed846f944a369e6738174a5eabfbdcc (diff) | |
download | llvm-97a1570d8c31dc3bff12dd77b1ee824e1872bb69.zip llvm-97a1570d8c31dc3bff12dd77b1ee824e1872bb69.tar.gz llvm-97a1570d8c31dc3bff12dd77b1ee824e1872bb69.tar.bz2 |
X86InstrInfo: Optimize more combinations of SUB+CMP
`X86InstrInfo::optimizeCompareInstr` would only optimize a `SUB`
followed by a `CMP` in `isRedundantFlagInstr`. This extends the code to
also look for other combinations like `CMP`+`CMP`, `TEST`+`TEST`, `SUB
x,0`+`TEST`.
- Change `isRedundantFlagInstr` to run `analyzeCompareInstr` on the
candidate instruction and compare the results. This normalizes things
and gives consistent results for various comparisons (`CMP x, y`,
`SUB x, y`) and immediate cases (`TEST x, x`, `SUB x, 0`,
`CMP x, 0`...).
- Turn `isRedundantFlagInstr` into a member function so it can call
`analyzeCompare`. - We now also check `isRedundantFlagInstr` even if
`IsCmpZero` is true, since we now have cases like `TEST`+`TEST`.
Differential Revision: https://reviews.llvm.org/D110865
Diffstat (limited to 'llvm/lib/CodeGen/TwoAddressInstructionPass.cpp')
0 files changed, 0 insertions, 0 deletions