Intrinsics: Mark llvm.eh.sjlj.callsite argument as immarg

The assert in SelectionDAG implies that it is
This commit is contained in:
Matt Arsenault 2022-04-17 16:39:02 -04:00
parent d16945d31b
commit 8591328e15
3 changed files with 12 additions and 3 deletions

View File

@ -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]>;

View File

@ -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());

View File

@ -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
}