[llvm] r268142 - [LowerGuardIntrinsics] Preserve calling conv when lowering

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 29 17:17:48 PDT 2016


Author: sanjoy
Date: Fri Apr 29 19:17:47 2016
New Revision: 268142

URL: http://llvm.org/viewvc/llvm-project?rev=268142&view=rev
Log:
[LowerGuardIntrinsics] Preserve calling conv when lowering

Added:
    llvm/trunk/test/Transforms/LowerGuardIntrinsic/with-calling-conv.ll
Modified:
    llvm/trunk/lib/Transforms/Scalar/LowerGuardIntrinsic.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LowerGuardIntrinsic.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LowerGuardIntrinsic.cpp?rev=268142&r1=268141&r2=268142&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LowerGuardIntrinsic.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LowerGuardIntrinsic.cpp Fri Apr 29 19:17:47 2016
@@ -66,6 +66,7 @@ static void MakeGuardControlFlowExplicit
     B.CreateRet(DeoptCall);
   }
 
+  DeoptCall->setCallingConv(CI->getCallingConv());
   DeoptBlockTerm->eraseFromParent();
 }
 
@@ -89,6 +90,7 @@ bool LowerGuardIntrinsic::runOnFunction(
 
   auto *DeoptIntrinsic = Intrinsic::getDeclaration(
       F.getParent(), Intrinsic::experimental_deoptimize, {F.getReturnType()});
+  DeoptIntrinsic->setCallingConv(GuardDecl->getCallingConv());
 
   for (auto *CI : ToLower) {
     MakeGuardControlFlowExplicit(DeoptIntrinsic, CI);

Added: llvm/trunk/test/Transforms/LowerGuardIntrinsic/with-calling-conv.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LowerGuardIntrinsic/with-calling-conv.ll?rev=268142&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/LowerGuardIntrinsic/with-calling-conv.ll (added)
+++ llvm/trunk/test/Transforms/LowerGuardIntrinsic/with-calling-conv.ll Fri Apr 29 19:17:47 2016
@@ -0,0 +1,15 @@
+; RUN: opt -S -lower-guard-intrinsic < %s | FileCheck %s
+
+declare cc99 void @llvm.experimental.guard(i1, ...)
+
+define i8 @f_basic(i1* %c_ptr) {
+; CHECK-LABEL: @f_basic(
+; CHECK:  br i1 %c, label %guarded, label %deopt
+; CHECK: deopt:
+; CHECK-NEXT:  %deoptcall = call cc99 i8 (...) @llvm.experimental.deoptimize.i8() [ "deopt"() ]
+; CHECK-NEXT:  ret i8 %deoptcall
+
+  %c = load volatile i1, i1* %c_ptr
+  call cc99 void(i1, ...) @llvm.experimental.guard(i1 %c) [ "deopt"() ]
+  ret i8 6
+}




More information about the llvm-commits mailing list