[llvm] [AArch64] Allow peephole to optimize AND + signed compare with 0 (PR #153608)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 22 08:49:24 PDT 2025
================
@@ -1921,7 +1998,8 @@ static bool canInstrSubstituteCmpInstr(MachineInstr &MI, MachineInstr &CmpInstr,
// 1) MI and CmpInstr set N and V to the same value.
// 2) If MI is add/sub with no-signed-wrap, it produces a poison value when
// signed overflow occurs, so CmpInstr could still be simplified away.
- if (NZVCUsed->V && !MI.getFlag(MachineInstr::NoSWrap))
+ // 3) ANDS/BICS on AArch64 always sets V to 0, so it is safe to look through.
----------------
AZero13 wrote:
It's not.
SLE 0 is not MI
https://github.com/llvm/llvm-project/pull/153608
More information about the llvm-commits
mailing list