Skip to content

[RISCV] Correct the SDTypeProfile for RISCVISD::PROBED_ALLOCA #139135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24504,7 +24504,7 @@ RISCVTargetLowering::emitDynamicProbedAlloc(MachineInstr &MI,
MachineFunction &MF = *MBB->getParent();
MachineBasicBlock::iterator MBBI = MI.getIterator();
DebugLoc DL = MBB->findDebugLoc(MBBI);
Register TargetReg = MI.getOperand(1).getReg();
Register TargetReg = MI.getOperand(0).getReg();

const RISCVInstrInfo *TII = Subtarget.getInstrInfo();
bool IsRV64 = Subtarget.is64Bit();
Expand Down
13 changes: 6 additions & 7 deletions llvm/lib/Target/RISCV/RISCVInstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ def riscv_add_tprel : SDNode<"RISCVISD::ADD_TPREL",
SDTCisInt<0>]>>;

def riscv_probed_alloca : SDNode<"RISCVISD::PROBED_ALLOCA",
SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>,
SDTCisVT<0, i32>]>,
SDTypeProfile<0, 1, [SDTCisPtrTy<0>]>,
[SDNPHasChain, SDNPMayStore]>;

//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -1456,17 +1455,17 @@ let hasSideEffects = 1, mayLoad = 1, mayStore = 1, isCodeGenOnly = 1 in {
// Probed stack allocation of a constant size, used in function prologues when
// stack-clash protection is enabled.
def PROBED_STACKALLOC : Pseudo<(outs GPR:$sp),
(ins GPR:$scratch),
(ins GPR:$target),
[]>,
Sched<[]>;
def PROBED_STACKALLOC_RVV : Pseudo<(outs GPR:$sp),
(ins GPR:$scratch),
(ins GPR:$target),
[]>,
Sched<[]>;
let usesCustomInserter = 1 in
def PROBED_STACKALLOC_DYN : Pseudo<(outs GPR:$rd),
(ins GPR:$scratch),
[(set GPR:$rd, (riscv_probed_alloca GPR:$scratch))]>,
def PROBED_STACKALLOC_DYN : Pseudo<(outs),
(ins GPR:$target),
[(riscv_probed_alloca GPR:$target)]>,
Sched<[]>;
}

Expand Down
Loading