summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2016-03-22 00:59:13 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2016-03-22 00:59:13 +0000
commit38bfc22161d94b4b6fb6fed5bf498afe936ab874 (patch)
tree079f55a8d951253bb5359cffe7e8fd9685004bda /llvm/test
parentea4ae806bb12e89398558f4d033f06bf91463923 (diff)
downloadbcm5719-llvm-38bfc22161d94b4b6fb6fed5bf498afe936ab874.tar.gz
bcm5719-llvm-38bfc22161d94b4b6fb6fed5bf498afe936ab874.zip
Add "first class" lowering for deopt operand bundles
Summary: After this change, deopt operand bundles can be lowered directly by SelectionDAG into STATEPOINT instructions (which are then lowered to a call or sequence of nop, with an associated __llvm_stackmaps entry0. This obviates the need to round-trip deoptimization state through gc.statepoint via RewriteStatepointsForGC. Reviewers: reames, atrick, majnemer, JosephTremoulet, pgavlin Subscribers: sanjoy, mcrosier, majnemer, llvm-commits Differential Revision: http://reviews.llvm.org/D18257 llvm-svn: 264015
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/CodeGen/X86/deopt-bundles.ll104
1 files changed, 104 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/deopt-bundles.ll b/llvm/test/CodeGen/X86/deopt-bundles.ll
new file mode 100644
index 00000000000..46516b57a42
--- /dev/null
+++ b/llvm/test/CodeGen/X86/deopt-bundles.ll
@@ -0,0 +1,104 @@
+; RUN: llc -debug-only=stackmaps < %s 2>&1 | FileCheck %s
+; RUN: llc -debug-only=stackmaps -O3 < %s 2>&1 | FileCheck %s
+; REQUIRES: asserts
+
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-macosx10.11.0"
+
+
+; CHECK: Stack Maps: callsite 2882400015
+; CHECK-NEXT: Stack Maps: has 4 locations
+; CHECK-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 8, .short 0, .int 0]
+; CHECK-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 8, .short 0, .int 0]
+; CHECK-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 8, .short 0, .int 1]
+; CHECK-NEXT: Stack Maps: Loc 3: Constant 0 [encoding: .byte 4, .byte 8, .short 0, .int 0]
+; CHECK-NEXT: Stack Maps: has 0 live-out registers
+; CHECK-NEXT: Stack Maps: callsite 4242
+; CHECK-NEXT: Stack Maps: has 4 locations
+; CHECK-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 8, .short 0, .int 0]
+; CHECK-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 8, .short 0, .int 0]
+; CHECK-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 8, .short 0, .int 1]
+; CHECK-NEXT: Stack Maps: Loc 3: Constant 1 [encoding: .byte 4, .byte 8, .short 0, .int 1]
+; CHECK-NEXT: Stack Maps: has 0 live-out registers
+; CHECK-NEXT: Stack Maps: callsite 2882400015
+; CHECK-NEXT: Stack Maps: has 4 locations
+; CHECK-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 8, .short 0, .int 0]
+; CHECK-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 8, .short 0, .int 0]
+; CHECK-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 8, .short 0, .int 1]
+; CHECK-NEXT: Stack Maps: Loc 3: Constant 2 [encoding: .byte 4, .byte 8, .short 0, .int 2]
+; CHECK-NEXT: Stack Maps: has 0 live-out registers
+; CHECK-NEXT: Stack Maps: callsite 2882400015
+; CHECK-NEXT: Stack Maps: has 4 locations
+; CHECK-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 8, .short 0, .int 0]
+; CHECK-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 8, .short 0, .int 0]
+; CHECK-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 8, .short 0, .int 1]
+; CHECK-NEXT: Stack Maps: Loc 3: Constant 3 [encoding: .byte 4, .byte 8, .short 0, .int 3]
+; CHECK-NEXT: Stack Maps: has 0 live-out registers
+
+
+declare i32 @callee_0()
+declare i32 @callee_1(i32)
+
+define i32 @caller_0() {
+; CHECK-LABEL: _caller_0
+entry:
+ %v = call i32 @callee_0() [ "deopt"(i32 0) ]
+ %v2 = add i32 %v, 1
+ ret i32 %v2
+; CHECK: callq _callee_0
+; CHECK: incl %eax
+; CHECK: retq
+}
+
+define i32 @caller_1() {
+; CHECK-LABEL: _caller_1
+entry:
+ %v = call i32 @callee_1(i32 42) "statepoint-id"="4242" [ "deopt"(i32 1) ]
+ ret i32 %v
+; CHECK: callq _callee_1
+; CHECK: popq %rcx
+; CHECK: retq
+}
+
+define i32 @invoker_0() personality i8 0 {
+; CHECK-LABEL: _invoker_0
+entry:
+ %v = invoke i32 @callee_0() [ "deopt"(i32 2) ]
+ to label %normal unwind label %uw
+
+normal:
+ ret i32 %v
+
+uw:
+ %ehvals = landingpad { i8*, i32 }
+ cleanup
+ ret i32 1
+; CHECK: callq _callee_0
+; CHECK: popq %rcx
+; CHECK: retq
+; CHECK: movl $1, %eax
+; CHECK: popq %rcx
+; CHECK: retq
+}
+
+define i32 @invoker_1() personality i8 0 {
+; CHECK-LABEL: _invoker_1
+entry:
+ %v = invoke i32 @callee_1(i32 45) "statepoint-num-patch-bytes"="9" [ "deopt"(i32 3) ]
+ to label %normal unwind label %uw
+
+normal:
+ ret i32 %v
+
+uw:
+ %ehvals = landingpad { i8*, i32 }
+ cleanup
+ ret i32 1
+; CHECK: movl $45, %edi
+; CHECK: nopw 512(%rax,%rax)
+; CHECK: popq %rcx
+; CHECK: retq
+; CHECK: movl $1, %eax
+; CHECK: popq %rcx
+; CHECK: retq
+}
OpenPOWER on IntegriCloud