From cb0f947a2a81730e054b39b0dfb4d90bd52cee61 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Wed, 23 Dec 2015 23:44:28 +0000 Subject: [Statepoints] Use Indirect operands for spill slots Teach the statepoint lowering code to emit Indirect stackmap entries for spill inserted by StatepointLowering (i.e. SelectionDAG), but Direct stackmap entries for in-IR allocas which represent manual stack slots. This is what the docs call for (http://llvm.org/docs/StackMaps.html#stack-map-format), but we've been emitting both as Direct. This was pointed out recently on the mailing list as a bug. It also blocks http://reviews.llvm.org/D15632 which extends the lowering to handle vector-of-pointers since only Indirect references can encode a variable sized slot. To implement this, I introduced a new flag on the StackObject class used to maintian information about stack slots. I original considered (and prototyped in http://reviews.llvm.org/D15632), the idea of using the existing isSpillSlot flag, but end up deciding that was a bit too risky and that the cost of adding a new flag was low. Having the new flag will also allow us - in the future - to emit better comments in verbose assembly which indicate where a particular stack spill around a call comes from. (deopt, gc, regalloc). Differential Revision: http://reviews.llvm.org/D15759 llvm-svn: 256352 --- .../test/CodeGen/X86/statepoint-stackmap-format.ll | 64 +++++++++++----------- 1 file changed, 31 insertions(+), 33 deletions(-) (limited to 'llvm/test/CodeGen') diff --git a/llvm/test/CodeGen/X86/statepoint-stackmap-format.ll b/llvm/test/CodeGen/X86/statepoint-stackmap-format.ll index 2b7f077a4b2..5c9f54f89ff 100644 --- a/llvm/test/CodeGen/X86/statepoint-stackmap-format.ll +++ b/llvm/test/CodeGen/X86/statepoint-stackmap-format.ll @@ -11,7 +11,7 @@ declare zeroext i1 @return_i1() define i1 @test(i32 addrspace(1)* %ptr_base, i32 %arg) gc "statepoint-example" { -; CHECK-LABEL: test +; CHECK-LABEL: test: ; Do we see two spills for the local values and the store to the ; alloca? ; CHECK: subq $40, %rsp @@ -94,18 +94,19 @@ declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32) #3 ; CHECK-NEXT: .quad 40 ; CHECK-NEXT: .quad test_derived_arg ; CHECK-NEXT: .quad 40 +; CHECK-NEXT: .quad test_id +; CHECK-NEXT: .quad 8 ; ; test ; -; Large Constants -; Statepoint ID only -; CHECK: .quad 0 +; Statepoint ID +; CHECK-NEXT: .quad 0 ; Callsites ; Constant arguments -; CHECK: .long .Ltmp1-test +; CHECK-NEXT: .long .Ltmp1-test ; CHECK: .short 0 ; CHECK: .short 11 ; SmallConstant (0) @@ -123,8 +124,8 @@ declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32) #3 ; CHECK: .byte 8 ; CHECK: .short 0 ; CHECK: .long 2 -; Direct Spill Slot [RSP+0] -; CHECK: .byte 2 +; Indirect Spill Slot [RSP+0] +; CHECK: .byte 3 ; CHECK: .byte 8 ; CHECK: .short 7 ; CHECK: .long 16 @@ -143,23 +144,23 @@ declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32) #3 ; CHECK: .byte 8 ; CHECK: .short 0 ; CHECK: .long 0 -; Direct Spill Slot [RSP+16] -; CHECK: .byte 2 +; Indirect Spill Slot [RSP+16] +; CHECK: .byte 3 ; CHECK: .byte 8 ; CHECK: .short 7 ; CHECK: .long 16 -; Direct Spill Slot [RSP+8] -; CHECK: .byte 2 +; Indirect Spill Slot [RSP+8] +; CHECK: .byte 3 ; CHECK: .byte 8 ; CHECK: .short 7 ; CHECK: .long 8 -; Direct Spill Slot [RSP+16] -; CHECK: .byte 2 +; Indirect Spill Slot [RSP+16] +; CHECK: .byte 3 ; CHECK: .byte 8 ; CHECK: .short 7 ; CHECK: .long 16 -; Direct Spill Slot [RSP+16] -; CHECK: .byte 2 +; Indirect Spill Slot [RSP+16] +; CHECK: .byte 3 ; CHECK: .byte 8 ; CHECK: .short 7 ; CHECK: .long 16 @@ -171,15 +172,13 @@ declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32) #3 ; ; test_derived_arg -; -; Large Constants -; Statepoint ID only -; CHECK: .quad 0 +; Statepoint ID +; CHECK-NEXT: .quad 0 ; Callsites ; Constant arguments -; CHECK: .long .Ltmp3-test_derived_arg +; CHECK-NEXT: .long .Ltmp3-test_derived_arg ; CHECK: .short 0 ; CHECK: .short 11 ; SmallConstant (0) @@ -192,8 +191,8 @@ declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32) #3 ; CHECK: .byte 8 ; CHECK: .short 0 ; CHECK: .long 2 -; Direct Spill Slot [RSP+0] -; CHECK: .byte 2 +; Indirect Spill Slot [RSP+0] +; CHECK: .byte 3 ; CHECK: .byte 8 ; CHECK: .short 7 ; CHECK: .long 16 @@ -212,23 +211,23 @@ declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32) #3 ; CHECK: .byte 8 ; CHECK: .short 0 ; CHECK: .long 0 -; Direct Spill Slot [RSP+16] -; CHECK: .byte 2 +; Indirect Spill Slot [RSP+16] +; CHECK: .byte 3 ; CHECK: .byte 8 ; CHECK: .short 7 ; CHECK: .long 16 -; Direct Spill Slot [RSP+8] -; CHECK: .byte 2 +; Indirect Spill Slot [RSP+8] +; CHECK: .byte 3 ; CHECK: .byte 8 ; CHECK: .short 7 ; CHECK: .long 8 -; Direct Spill Slot [RSP+16] -; CHECK: .byte 2 +; Indirect Spill Slot [RSP+16] +; CHECK: .byte 3 ; CHECK: .byte 8 ; CHECK: .short 7 ; CHECK: .long 16 -; Direct Spill Slot [RSP+16] -; CHECK: .byte 2 +; Indirect Spill Slot [RSP+16] +; CHECK: .byte 3 ; CHECK: .byte 8 ; CHECK: .short 7 ; CHECK: .long 16 @@ -239,13 +238,12 @@ declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32) #3 ; CHECK: .align 8 ; Records for the test_id function: -; No large constants ; The Statepoint ID: -; CHECK: .quad 237 +; CHECK-NEXT: .quad 237 ; Instruction Offset -; CHECK: .long .Ltmp5-test_id +; CHECK-NEXT: .long .Ltmp5-test_id ; Reserved: ; CHECK: .short 0 -- cgit v1.2.3