[llvm] 8591328 - Intrinsics: Mark llvm.eh.sjlj.callsite argument as immarg
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 19 18:04:51 PDT 2022
Author: Matt Arsenault
Date: 2022-04-19T21:04:33-04:00
New Revision: 8591328e15940c5b36d30954fdcc065597dc0d76
URL: https://github.com/llvm/llvm-project/commit/8591328e15940c5b36d30954fdcc065597dc0d76
DIFF: https://github.com/llvm/llvm-project/commit/8591328e15940c5b36d30954fdcc065597dc0d76.diff
LOG: Intrinsics: Mark llvm.eh.sjlj.callsite argument as immarg
The assert in SelectionDAG implies that it is
Added:
Modified:
llvm/include/llvm/IR/Intrinsics.td
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/test/Verifier/intrinsic-immarg.ll
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td
index 9dd3ccf35276b..29ce056056776 100644
--- a/llvm/include/llvm/IR/Intrinsics.td
+++ b/llvm/include/llvm/IR/Intrinsics.td
@@ -999,7 +999,7 @@ def int_eh_unwind_init: Intrinsic<[]>,
def int_eh_dwarf_cfa : Intrinsic<[llvm_ptr_ty], [llvm_i32_ty]>;
def int_eh_sjlj_lsda : Intrinsic<[llvm_ptr_ty], [], [IntrNoMem]>;
-def int_eh_sjlj_callsite : Intrinsic<[], [llvm_i32_ty], [IntrNoMem]>;
+def int_eh_sjlj_callsite : Intrinsic<[], [llvm_i32_ty], [IntrNoMem, ImmArg<ArgIndex<0>>]>;
def int_eh_sjlj_functioncontext : Intrinsic<[], [llvm_ptr_ty]>;
def int_eh_sjlj_setjmp : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty]>;
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index ff84699f29fef..7ef919642c2cb 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -6158,8 +6158,7 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
return;
case Intrinsic::eh_sjlj_callsite: {
MachineModuleInfo &MMI = DAG.getMachineFunction().getMMI();
- ConstantInt *CI = dyn_cast<ConstantInt>(I.getArgOperand(0));
- assert(CI && "Non-constant call site value in eh.sjlj.callsite!");
+ ConstantInt *CI = cast<ConstantInt>(I.getArgOperand(0));
assert(MMI.getCurrentCallSite() == 0 && "Overlapping call sites!");
MMI.setCurrentCallSite(CI->getZExtValue());
diff --git a/llvm/test/Verifier/intrinsic-immarg.ll b/llvm/test/Verifier/intrinsic-immarg.ll
index 68297678c0b61..e1e77a9bfd209 100644
--- a/llvm/test/Verifier/intrinsic-immarg.ll
+++ b/llvm/test/Verifier/intrinsic-immarg.ll
@@ -247,3 +247,13 @@ define void @hwasan_check_memaccess(i8* %arg0,i8* %arg1, i32 %arg2) {
call void @llvm.hwasan.check.memaccess(i8* %arg0,i8* %arg1, i32 %arg2)
ret void
}
+
+declare void @llvm.eh.sjlj.callsite(i32)
+
+define void @eh_sjlj_callsite(i32 %arg0) {
+ ; CHECK: immarg operand has non-immediate parameter
+ ; CHECK: i32 %arg0
+ ; CHECK: call void @llvm.eh.sjlj.callsite(i32 %arg0)
+ call void @llvm.eh.sjlj.callsite(i32 %arg0)
+ ret void
+}
More information about the llvm-commits
mailing list