[llvm] [RISCV] Use implicit def/use of SP for PROBED_STACKALLOC*. (PR #139153)
Sergei Barannikov via llvm-commits
llvm-commits at lists.llvm.org
Thu May 8 14:01:33 PDT 2025
================
@@ -1452,17 +1452,18 @@ def GIAddrRegImm :
/// Stack probing
-let hasSideEffects = 1, mayLoad = 1, mayStore = 1, isCodeGenOnly = 1 in {
+let hasSideEffects = 1, mayLoad = 1, mayStore = 1, isCodeGenOnly = 1,
+ Defs = [X2], Uses = [X2] 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),
- []>,
- Sched<[]>;
-def PROBED_STACKALLOC_RVV : Pseudo<(outs GPR:$sp),
- (ins GPR:$scratch),
+def PROBED_STACKALLOC : Pseudo<(outs),
+ (ins GPR:$target),
[]>,
Sched<[]>;
+def PROBED_STACKALLOC_RVV : Pseudo<(outs),
+ (ins GPR:$target),
----------------
s-barannikov wrote:
(pedantic nit) Not sure it makes any difference, but from liveness point of view this should probably be:
```suggestion
let Constraints = "$scratch = $target" in
def PROBED_STACKALLOC_RVV : Pseudo<(outs GPR:$scratch),
(ins GPR:$target),
```
since RVV expansion [modifies](https://github.com/llvm/llvm-project/blob/4e175b889669b430113ce0216e0ee1fe7884889c/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp#L2373) the `$target` register.
https://github.com/llvm/llvm-project/pull/139153
More information about the llvm-commits
mailing list