[RISCV] Fix stackmap shadow trimming NOP size for compressed targets (#189774)
The shadow trimming loop in LowerSTACKMAP hardcoded a 4-byte decrement per instruction, but when Zca is enabled NOPs are 2 bytes. Use NOPBytes instead of the hardcoded 4 so the shadow is correctly trimmed on compressed targets. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b9e01c26f0
commit
3d7eedce56
@ -155,7 +155,7 @@ void RISCVAsmPrinter::LowerSTACKMAP(MCStreamer &OutStreamer, StackMaps &SM,
|
||||
MII->getOpcode() == TargetOpcode::STACKMAP)
|
||||
break;
|
||||
++MII;
|
||||
NumNOPBytes -= 4;
|
||||
NumNOPBytes -= NOPBytes;
|
||||
}
|
||||
|
||||
// Emit nops.
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
||||
; RUN: llc < %s -mtriple=riscv64 | FileCheck %s
|
||||
; RUN: llc < %s -mtriple=riscv64 | FileCheck %s --check-prefix=CHECK
|
||||
; RUN: llc < %s -mtriple=riscv64 -mattr=+c | FileCheck %s --check-prefix=RVC
|
||||
|
||||
define void @test_shadow_optimization() {
|
||||
; CHECK-LABEL: test_shadow_optimization:
|
||||
@ -9,8 +10,19 @@ define void @test_shadow_optimization() {
|
||||
; CHECK-NEXT: nop
|
||||
; CHECK-NEXT: nop
|
||||
; CHECK-NEXT: ret
|
||||
;
|
||||
; RVC-LABEL: test_shadow_optimization:
|
||||
; RVC: # %bb.0: # %entry
|
||||
; RVC-NEXT: .Ltmp0:
|
||||
; RVC-NEXT: nop
|
||||
; RVC-NEXT: nop
|
||||
; RVC-NEXT: nop
|
||||
; RVC-NEXT: nop
|
||||
; RVC-NEXT: nop
|
||||
; RVC-NEXT: nop
|
||||
; RVC-NEXT: nop
|
||||
; RVC-NEXT: ret
|
||||
entry:
|
||||
tail call void (i64, i32, ...) @llvm.experimental.stackmap(i64 0, i32 16)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user