[llvm] [AArch64] Avoid applying S-form on frame index in peephole (PR #158597)
Hongyu Chen via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 15 07:58:27 PDT 2025
================
@@ -1920,6 +1920,11 @@ static bool canInstrSubstituteCmpInstr(MachineInstr &MI, MachineInstr &CmpInstr,
CmpInstr.getOperand(2).getImm() == 0) &&
"Caller guarantees that CmpInstr compares with constant 0");
+ // NZCV is not supported if the stack offset is scalable.
+ auto &ST = MI.getParent()->getParent()->getSubtarget<AArch64Subtarget>();
+ if ((ST.hasSVE() || ST.isStreaming()) && MI.getOperand(1).isFI())
----------------
XChy wrote:
IIUC, the object on the frame index is unrelated to the stack offset? The stack offset is determined in PrologEpilogInserter. This patch just disallows the optimization for SVE. If we want to optimize precisely, we should reverse the optimization in `emitFrameOffset`.
https://github.com/llvm/llvm-project/pull/158597
More information about the llvm-commits
mailing list