[Statepoints] Add test cases around vectors and stablize test
authorPhilip Reames <listmail@philipreames.com>
Thu, 7 Jan 2016 04:15:31 +0000 (04:15 +0000)
committerPhilip Reames <listmail@philipreames.com>
Thu, 7 Jan 2016 04:15:31 +0000 (04:15 +0000)
Unlike my comment in 257022 said, it turns out we do handle constant vectors in the statepoint lowering, but only because SelectionDAG doesn't actually produce constants for them.  Add a couple of tests which show this working.

Also, add a triple to the same test file to hopefully fix a failing bot.

It turns out we do han

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257025 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/StatepointLowering.cpp
test/CodeGen/X86/statepoint-vector.ll

index 05363fc05964c52478f1e4c680c5836b89cefef9..02545a73065608a51dfa9514b44f1d0dfe51325a 100644 (file)
@@ -461,7 +461,9 @@ static void lowerIncomingStatepointValue(SDValue Incoming,
     // If the original value was a constant, make sure it gets recorded as
     // such in the stackmap.  This is required so that the consumer can
     // parse any internal format to the deopt state.  It also handles null
     // If the original value was a constant, make sure it gets recorded as
     // such in the stackmap.  This is required so that the consumer can
     // parse any internal format to the deopt state.  It also handles null
-    // pointers and other constant pointers in GC states
+    // pointers and other constant pointers in GC states.  Note the constant
+    // vectors do not appear to actually hit this path and that anything larger
+    // than an i64 value (not type!) will fail asserts here.
     pushStackMapConstant(Ops, Builder, C->getSExtValue());
   } else if (FrameIndexSDNode *FI = dyn_cast<FrameIndexSDNode>(Incoming)) {
     // This handles allocas as arguments to the statepoint (this is only
     pushStackMapConstant(Ops, Builder, C->getSExtValue());
   } else if (FrameIndexSDNode *FI = dyn_cast<FrameIndexSDNode>(Incoming)) {
     // This handles allocas as arguments to the statepoint (this is only
index 81d78d6de7c69a7c15be7cafccdd987d8bb0a524..f19f77b529f49ca71d35b71b10e1bb8e4e09e23b 100644 (file)
@@ -1,5 +1,7 @@
 ; RUN: llc -debug-only=stackmaps < %s | FileCheck %s
 
 ; RUN: llc -debug-only=stackmaps < %s | FileCheck %s
 
+target triple = "x86_64-pc-linux-gnu"
+
 ; Can we lower a single vector?
 define <2 x i8 addrspace(1)*> @test(<2 x i8 addrspace(1)*> %obj) gc "statepoint-example" {
 entry:
 ; Can we lower a single vector?
 define <2 x i8 addrspace(1)*> @test(<2 x i8 addrspace(1)*> %obj) gc "statepoint-example" {
 entry:
@@ -72,6 +74,35 @@ merge:                                            ; preds = %untaken, %taken
   ret <2 x i64 addrspace(1)*> %obj.relocated.casted
 }
 
   ret <2 x i64 addrspace(1)*> %obj.relocated.casted
 }
 
+; Can we handle vector constants?  At the moment, we don't appear to actually
+; get selection dag nodes for these.
+define <2 x i8 addrspace(1)*> @test4() gc "statepoint-example" {
+entry:
+; CHECK-LABEL: @test4
+; CHECK: subq  $24, %rsp
+; CHECK: xorps %xmm0, %xmm0
+; CHECK: movaps        %xmm0, (%rsp)
+; CHECK: callq do_safepoint
+; CHECK: movaps        (%rsp), %xmm0
+; CHECK: addq  $24, %rsp
+  %safepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0, <2 x i8 addrspace(1)*> zeroinitializer)
+  %obj.relocated = call coldcc <2 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v2p1i8(token %safepoint_token, i32 7, i32 7) ; (%obj, %obj)
+  ret <2 x i8 addrspace(1)*> %obj.relocated
+}
+
+; Check that we can lower a constant typed as i128 correctly.  Note that the
+; actual value is representable in 64 bits.  We don't have a representation 
+; of larger than 64 bit constant in the StackMap format.
+define void @test5() gc "statepoint-example" {
+entry:
+; CHECK-LABEL: @test5
+; CHECK: push
+; CHECK: callq do_safepoint
+; CHECK: pop
+  %safepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 1, i128 0)
+  ret void
+}
+
 ; CHECK: __LLVM_StackMaps:
 
 ; CHECK: .Ltmp1-test
 ; CHECK: __LLVM_StackMaps:
 
 ; CHECK: .Ltmp1-test