[llvm] r265867 - Maintain calling convention when inling calls to llvm.deoptimize
Sanjoy Das via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 8 17:23:00 PDT 2016
Author: sanjoy
Date: Fri Apr 8 19:22:59 2016
New Revision: 265867
URL: http://llvm.org/viewvc/llvm-project?rev=265867&view=rev
Log:
Maintain calling convention when inling calls to llvm.deoptimize
The behavior here was buggy -- we'd forget the calling convention after
inlining a callsite calling llvm.deoptimize.
Modified:
llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
llvm/trunk/test/Transforms/Inline/deoptimize-intrinsic.ll
Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=265867&r1=265866&r2=265867&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Fri Apr 8 19:22:59 2016
@@ -1843,6 +1843,7 @@ bool llvm::InlineFunction(CallSite CS, I
continue;
}
+ auto CallingConv = DeoptCall->getCallingConv();
auto *CurBB = RI->getParent();
RI->eraseFromParent();
@@ -1856,8 +1857,9 @@ bool llvm::InlineFunction(CallSite CS, I
"Expected at least the deopt operand bundle");
IRBuilder<> Builder(CurBB);
- Value *NewDeoptCall =
+ CallInst *NewDeoptCall =
Builder.CreateCall(NewDeoptIntrinsic, CallArgs, OpBundles);
+ NewDeoptCall->setCallingConv(CallingConv);
if (NewDeoptCall->getType()->isVoidTy())
Builder.CreateRetVoid();
else
Modified: llvm/trunk/test/Transforms/Inline/deoptimize-intrinsic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/deoptimize-intrinsic.ll?rev=265867&r1=265866&r2=265867&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Inline/deoptimize-intrinsic.ll (original)
+++ llvm/trunk/test/Transforms/Inline/deoptimize-intrinsic.ll Fri Apr 8 19:22:59 2016
@@ -1,6 +1,7 @@
; RUN: opt -S -always-inline < %s | FileCheck %s
declare i8 @llvm.experimental.deoptimize.i8(...)
+declare cc42 i32 @llvm.experimental.deoptimize.i32(...)
define i8 @callee(i1* %c) alwaysinline {
%c0 = load volatile i1, i1* %c
@@ -120,3 +121,17 @@ define void @caller_with_stacksaverestor
call i8 @callee_with_dynamic_alloca(i32 %n)
ret void
}
+
+define i32 @callee_with_coldcc() alwaysinline {
+ %v0 = call cc42 i32(...) @llvm.experimental.deoptimize.i32(i32 1) [ "deopt"() ]
+ ret i32 %v0
+}
+
+define void @caller_with_coldcc() {
+; CHECK-LABEL: @caller_with_coldcc(
+; CHECK-NEXT: call cc42 void (...) @llvm.experimental.deoptimize.isVoid(i32 1) [ "deopt"() ]
+; CHECK-NEXT: ret void
+
+ %val = call i32 @callee_with_coldcc()
+ ret void
+}
More information about the llvm-commits
mailing list