[llvm] [AArch64] Allow peephole to optimize AND + signed compare with 0 (PR #153608)
Benjamin Maxwell via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 22 08:31:06 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.
----------------
MacDue wrote:
I think this case is already covered by `"MI and CmpInstr set N and V to the same value"`, which I think is true in this case.
https://github.com/llvm/llvm-project/pull/153608
More information about the llvm-commits
mailing list