[llvm] r264354 - Lower varargs correctly in deopt bundle lowering

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 24 15:37:52 PDT 2016


Author: sanjoy
Date: Thu Mar 24 17:37:52 2016
New Revision: 264354

URL: http://llvm.org/viewvc/llvm-project?rev=264354&view=rev
Log:
Lower varargs correctly in deopt bundle lowering

Earlier we were ignoring varargs in LowerCallSiteWithDeoptBundle because
populateCallLoweringInfo does not set CallLoweringInfo::IsVarArg.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
    llvm/trunk/test/CodeGen/X86/deopt-bundles.ll

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp?rev=264354&r1=264353&r2=264354&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp Thu Mar 24 17:37:52 2016
@@ -827,6 +827,7 @@ void SelectionDAGBuilder::LowerCallSiteW
   unsigned ArgBeginIndex = CS.arg_begin() - CS.getInstruction()->op_begin();
   populateCallLoweringInfo(SI.CLI, CS, ArgBeginIndex, CS.getNumArgOperands(),
                            Callee, CS.getType(), false);
+  SI.CLI.IsVarArg = CS.getFunctionType()->isVarArg();
 
   auto DeoptBundle = *CS.getOperandBundle(LLVMContext::OB_deopt);
 

Modified: llvm/trunk/test/CodeGen/X86/deopt-bundles.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/deopt-bundles.ll?rev=264354&r1=264353&r2=264354&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/deopt-bundles.ll (original)
+++ llvm/trunk/test/CodeGen/X86/deopt-bundles.ll Thu Mar 24 17:37:52 2016
@@ -21,6 +21,13 @@ target triple = "x86_64-apple-macosx10.1
 ; STACKMAPS-NEXT: Stack Maps: 		Loc 2: Constant 1	[encoding: .byte 4, .byte 8, .short 0, .int 1]
 ; STACKMAPS-NEXT: Stack Maps: 		Loc 3: Constant 1	[encoding: .byte 4, .byte 8, .short 0, .int 1]
 ; STACKMAPS-NEXT: Stack Maps: 	has 0 live-out registers
+; STACKMAPS-NEXT: Stack Maps: callsite 4243
+; STACKMAPS-NEXT: Stack Maps:   has 4 locations
+; STACKMAPS-NEXT: Stack Maps: 		Loc 0: Constant 0	[encoding: .byte 4, .byte 8, .short 0, .int 0]
+; STACKMAPS-NEXT: Stack Maps: 		Loc 1: Constant 0	[encoding: .byte 4, .byte 8, .short 0, .int 0]
+; STACKMAPS-NEXT: Stack Maps: 		Loc 2: Constant 1	[encoding: .byte 4, .byte 8, .short 0, .int 1]
+; STACKMAPS-NEXT: Stack Maps: 		Loc 3: Constant 16	[encoding: .byte 4, .byte 8, .short 0, .int 16]
+; STACKMAPS-NEXT: Stack Maps: 	has 0 live-out registers
 ; STACKMAPS-NEXT: Stack Maps: callsite 2882400015
 ; STACKMAPS-NEXT: Stack Maps:   has 4 locations
 ; STACKMAPS-NEXT: Stack Maps: 		Loc 0: Constant 0	[encoding: .byte 4, .byte 8, .short 0, .int 0]
@@ -46,6 +53,7 @@ target triple = "x86_64-apple-macosx10.1
 
 declare i32 @callee_0()
 declare i32 @callee_1(i32)
+declare i32 @callee_vararg(...)
 
 define i32 @caller_0() {
 ; CHECK-LABEL: _caller_0
@@ -68,6 +76,15 @@ entry:
 ; CHECK:	retq
 }
 
+define i32 @caller_vararg() {
+; CHECK-LABEL: _caller_vararg
+entry:
+; CHECK: movb    $1, %al
+; CHECK: callq   _callee_vararg
+  %v = call i32(...) @callee_vararg(i32 42, double 500.0) "statepoint-id"="4243" [ "deopt"(i32 16) ]
+  ret i32 %v
+}
+
 define i32 @invoker_0() personality i8 0 {
 ; CHECK-LABEL: _invoker_0
 entry:




More information about the llvm-commits mailing list