forked from OSchip/llvm-project
[rs4gc] autogen a bunch of tests for ease of update
This commit is contained in:
parent
8fe59ba51e
commit
c6ec563f02
|
@ -1,23 +1,31 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt < %s -rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s
|
||||
; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S 2>&1 | FileCheck %s
|
||||
|
||||
; The rewriting needs to make %obj loop variant by inserting a phi
|
||||
; of the original value and it's relocation.
|
||||
|
||||
declare i64 addrspace(1)* @generate_obj() "gc-leaf-function"
|
||||
|
||||
declare void @use_obj(i64 addrspace(1)*) "gc-leaf-function"
|
||||
|
||||
define void @def_use_safepoint() gc "statepoint-example" {
|
||||
; CHECK-LABEL: def_use_safepoint
|
||||
; CHECK: phi i64 addrspace(1)*
|
||||
; CHECK-DAG: [ %obj.relocated.casted, %loop ]
|
||||
; CHECK-DAG: [ %obj, %entry ]
|
||||
; The rewriting needs to make %obj loop variant by inserting a phi
|
||||
; of the original value and it's relocation.
|
||||
define void @test() gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[OBJ:%.*]] = call i64 addrspace(1)* @generate_obj()
|
||||
; CHECK-NEXT: br label [[LOOP:%.*]]
|
||||
; CHECK: loop:
|
||||
; CHECK-NEXT: [[DOT0:%.*]] = phi i64 addrspace(1)* [ [[OBJ]], [[ENTRY:%.*]] ], [ [[OBJ_RELOCATED_CASTED:%.*]], [[LOOP]] ]
|
||||
; CHECK-NEXT: call void @use_obj(i64 addrspace(1)* [[DOT0]])
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(i64 addrspace(1)* [[DOT0]]) ]
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 0, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED_CASTED]] = bitcast i8 addrspace(1)* [[OBJ_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: br label [[LOOP]]
|
||||
;
|
||||
entry:
|
||||
%obj = call i64 addrspace(1)* @generate_obj()
|
||||
br label %loop
|
||||
|
||||
loop: ; preds = %loop, %entry
|
||||
loop:
|
||||
call void @use_obj(i64 addrspace(1)* %obj)
|
||||
call void @do_safepoint() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
||||
br label %loop
|
||||
|
@ -28,38 +36,54 @@ declare void @do_safepoint()
|
|||
declare void @parse_point(i64 addrspace(1)*)
|
||||
|
||||
define i64 addrspace(1)* @test1(i32 %caller, i8 addrspace(1)* %a, i8 addrspace(1)* %b, i32 %unknown) gc "statepoint-example" {
|
||||
; CHECK-LABEL: test1
|
||||
; CHECK-LABEL: @test1(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: br i1 undef, label [[LEFT:%.*]], label [[RIGHT:%.*]]
|
||||
; CHECK: left:
|
||||
; CHECK-NEXT: [[A_CAST:%.*]] = bitcast i8 addrspace(1)* [[A:%.*]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[CAST:%.*]] = bitcast i8 addrspace(1)* [[A]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: switch i32 [[UNKNOWN:%.*]], label [[RIGHT]] [
|
||||
; CHECK-NEXT: i32 0, label [[MERGE:%.*]]
|
||||
; CHECK-NEXT: i32 1, label [[MERGE]]
|
||||
; CHECK-NEXT: i32 5, label [[MERGE]]
|
||||
; CHECK-NEXT: ]
|
||||
; CHECK: right:
|
||||
; CHECK-NEXT: [[B_CAST:%.*]] = bitcast i8 addrspace(1)* [[B:%.*]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[CAST1:%.*]] = bitcast i8 addrspace(1)* [[B]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: br label [[MERGE]]
|
||||
; CHECK: merge:
|
||||
; CHECK-NEXT: [[VALUE_BASE:%.*]] = phi i64 addrspace(1)* [ [[CAST]], [[LEFT]] ], [ [[CAST]], [[LEFT]] ], [ [[CAST]], [[LEFT]] ], [ [[CAST1]], [[RIGHT]] ], !is_base_value !0
|
||||
; CHECK-NEXT: [[VALUE:%.*]] = phi i64 addrspace(1)* [ [[A_CAST]], [[LEFT]] ], [ [[A_CAST]], [[LEFT]] ], [ [[A_CAST]], [[LEFT]] ], [ [[B_CAST]], [[RIGHT]] ]
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i64f(i64 2882400000, i32 0, void (i64 addrspace(1)*)* @parse_point, i32 1, i32 0, i64 addrspace(1)* [[VALUE]], i32 0, i32 0) [ "deopt"(i32 0, i32 0, i32 0, i32 0, i32 0), "gc-live"(i64 addrspace(1)* [[VALUE]], i64 addrspace(1)* [[VALUE_BASE]]) ]
|
||||
; CHECK-NEXT: [[VALUE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[VALUE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[VALUE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[VALUE_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[VALUE_BASE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[VALUE_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: ret i64 addrspace(1)* [[VALUE_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
br i1 undef, label %left, label %right
|
||||
|
||||
left: ; preds = %entry
|
||||
; CHECK: left:
|
||||
; CHECK-NEXT: %a.cast = bitcast i8 addrspace(1)* %a to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[CAST_L:%.*]] = bitcast i8 addrspace(1)* %a to i64 addrspace(1)*
|
||||
left:
|
||||
; Our safepoint placement pass calls removeUnreachableBlocks, which does a bunch
|
||||
; of simplifications to branch instructions. This bug is visible only when
|
||||
; there are multiple branches into the same block from the same predecessor, and
|
||||
; the following ceremony is to make that artefact survive a call to
|
||||
; the following ceremony is to make that artefact survive a call to
|
||||
; removeUnreachableBlocks. As an example, "br i1 undef, label %merge, label %merge"
|
||||
; will get simplified to "br label %merge" by removeUnreachableBlocks.
|
||||
%a.cast = bitcast i8 addrspace(1)* %a to i64 addrspace(1)*
|
||||
switch i32 %unknown, label %right [
|
||||
i32 0, label %merge
|
||||
i32 1, label %merge
|
||||
i32 5, label %merge
|
||||
i32 3, label %right
|
||||
i32 0, label %merge
|
||||
i32 1, label %merge
|
||||
i32 5, label %merge
|
||||
i32 3, label %right
|
||||
]
|
||||
|
||||
right: ; preds = %left, %left, %entry
|
||||
; CHECK: right:
|
||||
; CHECK-NEXT: %b.cast = bitcast i8 addrspace(1)* %b to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[CAST_R:%.*]] = bitcast i8 addrspace(1)* %b to i64 addrspace(1)*
|
||||
right:
|
||||
%b.cast = bitcast i8 addrspace(1)* %b to i64 addrspace(1)*
|
||||
br label %merge
|
||||
|
||||
merge: ; preds = %right, %left, %left, %left
|
||||
; CHECK: merge:
|
||||
; CHECK-NEXT: %value.base = phi i64 addrspace(1)* [ [[CAST_L]], %left ], [ [[CAST_L]], %left ], [ [[CAST_L]], %left ], [ [[CAST_R]], %right ], !is_base_value !0
|
||||
merge:
|
||||
%value = phi i64 addrspace(1)* [ %a.cast, %left ], [ %a.cast, %left ], [ %a.cast, %left ], [ %b.cast, %right ]
|
||||
call void @parse_point(i64 addrspace(1)* %value) [ "deopt"(i32 0, i32 0, i32 0, i32 0, i32 0) ]
|
||||
ret i64 addrspace(1)* %value
|
||||
|
@ -70,26 +94,42 @@ merge: ; preds = %right, %left, %left
|
|||
;; base phi/select per such node. This is testing an optimization, not a
|
||||
;; fundemental correctness criteria
|
||||
define void @test2(i1 %cnd, i64 addrspace(1)* %base_obj, i64 addrspace(1)* %base_arg2) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test2
|
||||
; CHECK-LABEL: @test2(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[OBJ:%.*]] = getelementptr i64, i64 addrspace(1)* [[BASE_OBJ:%.*]], i32 1
|
||||
; CHECK-NEXT: br label [[LOOP:%.*]]
|
||||
; CHECK: loop:
|
||||
; CHECK-NEXT: [[DOT0:%.*]] = phi i64 addrspace(1)* [ [[BASE_ARG2:%.*]], [[ENTRY:%.*]] ], [ [[BASE_ARG2_RELOCATED_CASTED:%.*]], [[LOOP]] ]
|
||||
; CHECK-NEXT: [[CURRENT_BASE:%.*]] = phi i64 addrspace(1)* [ [[BASE_OBJ]], [[ENTRY]] ], [ [[NEXT_BASE_RELOCATED_CASTED:%.*]], [[LOOP]] ], !is_base_value !0
|
||||
; CHECK-NEXT: [[CURRENT:%.*]] = phi i64 addrspace(1)* [ [[OBJ]], [[ENTRY]] ], [ [[NEXT_RELOCATED_CASTED:%.*]], [[LOOP]] ]
|
||||
; CHECK-NEXT: [[EXTRA:%.*]] = phi i64 addrspace(1)* [ [[OBJ]], [[ENTRY]] ], [ [[EXTRA2_RELOCATED_CASTED:%.*]], [[LOOP]] ]
|
||||
; CHECK-NEXT: [[NEXTA:%.*]] = getelementptr i64, i64 addrspace(1)* [[CURRENT]], i32 1
|
||||
; CHECK-NEXT: [[NEXT_BASE:%.*]] = select i1 [[CND:%.*]], i64 addrspace(1)* [[CURRENT_BASE]], i64 addrspace(1)* [[DOT0]], !is_base_value !0
|
||||
; CHECK-NEXT: [[NEXT:%.*]] = select i1 [[CND]], i64 addrspace(1)* [[NEXTA]], i64 addrspace(1)* [[DOT0]]
|
||||
; CHECK-NEXT: [[EXTRA2_BASE:%.*]] = select i1 [[CND]], i64 addrspace(1)* [[CURRENT_BASE]], i64 addrspace(1)* [[DOT0]], !is_base_value !0
|
||||
; CHECK-NEXT: [[EXTRA2:%.*]] = select i1 [[CND]], i64 addrspace(1)* [[NEXTA]], i64 addrspace(1)* [[DOT0]]
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @foo, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(i64 addrspace(1)* [[NEXT_BASE]], i64 addrspace(1)* [[NEXT]], i64 addrspace(1)* [[EXTRA2]], i64 addrspace(1)* [[DOT0]], i64 addrspace(1)* [[EXTRA2_BASE]]) ]
|
||||
; CHECK-NEXT: [[NEXT_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 0, i32 0)
|
||||
; CHECK-NEXT: [[NEXT_BASE_RELOCATED_CASTED]] = bitcast i8 addrspace(1)* [[NEXT_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[NEXT_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 0, i32 1)
|
||||
; CHECK-NEXT: [[NEXT_RELOCATED_CASTED]] = bitcast i8 addrspace(1)* [[NEXT_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[EXTRA2_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 4, i32 2)
|
||||
; CHECK-NEXT: [[EXTRA2_RELOCATED_CASTED]] = bitcast i8 addrspace(1)* [[EXTRA2_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[BASE_ARG2_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 3, i32 3)
|
||||
; CHECK-NEXT: [[BASE_ARG2_RELOCATED_CASTED]] = bitcast i8 addrspace(1)* [[BASE_ARG2_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[EXTRA2_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 4, i32 4)
|
||||
; CHECK-NEXT: [[EXTRA2_BASE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[EXTRA2_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: br label [[LOOP]]
|
||||
;
|
||||
entry:
|
||||
%obj = getelementptr i64, i64 addrspace(1)* %base_obj, i32 1
|
||||
br label %loop
|
||||
; CHECK-LABEL: loop
|
||||
; CHECK: %current.base = phi i64 addrspace(1)*
|
||||
; CHECK-DAG: [ %base_obj, %entry ]
|
||||
|
||||
; Given the two selects are equivelent, so are their base phis - ideally,
|
||||
; we'd have commoned these, but that's a missed optimization, not correctness.
|
||||
; CHECK-DAG: [ [[DISCARD:%.*.base.relocated.casted]], %loop ]
|
||||
; CHECK-NOT: extra.base
|
||||
; CHECK: next.base = select
|
||||
; CHECK: next = select
|
||||
; CHECK: extra2.base = select
|
||||
; CHECK: extra2 = select
|
||||
; CHECK: statepoint
|
||||
;; Both 'next' and 'extra2' are live across the backedge safepoint...
|
||||
|
||||
loop: ; preds = %loop, %entry
|
||||
loop:
|
||||
%current = phi i64 addrspace(1)* [ %obj, %entry ], [ %next, %loop ]
|
||||
%extra = phi i64 addrspace(1)* [ %obj, %entry ], [ %extra2, %loop ]
|
||||
%nexta = getelementptr i64, i64 addrspace(1)* %current, i32 1
|
||||
|
@ -100,54 +140,84 @@ loop: ; preds = %loop, %entry
|
|||
}
|
||||
|
||||
define i64 addrspace(1)* @test3(i1 %cnd, i64 addrspace(1)* %obj, i64 addrspace(1)* %obj2) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test3
|
||||
; CHECK-LABEL: @test3(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: br i1 [[CND:%.*]], label [[MERGE:%.*]], label [[TAKEN:%.*]]
|
||||
; CHECK: taken:
|
||||
; CHECK-NEXT: br label [[MERGE]]
|
||||
; CHECK: merge:
|
||||
; CHECK-NEXT: [[BDV_BASE:%.*]] = phi i64 addrspace(1)* [ [[OBJ:%.*]], [[ENTRY:%.*]] ], [ [[OBJ2:%.*]], [[TAKEN]] ], !is_base_value !0
|
||||
; CHECK-NEXT: [[BDV:%.*]] = phi i64 addrspace(1)* [ [[OBJ]], [[ENTRY]] ], [ [[OBJ2]], [[TAKEN]] ]
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @foo, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(i64 addrspace(1)* [[BDV]], i64 addrspace(1)* [[BDV_BASE]]) ]
|
||||
; CHECK-NEXT: [[BDV_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[BDV_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[BDV_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[BDV_BASE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: ret i64 addrspace(1)* [[BDV_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
br i1 %cnd, label %merge, label %taken
|
||||
|
||||
taken: ; preds = %entry
|
||||
taken:
|
||||
br label %merge
|
||||
|
||||
merge: ; preds = %taken, %entry
|
||||
; CHECK-LABEL: merge:
|
||||
; CHECK-NEXT: phi
|
||||
; CHECK-NEXT: phi
|
||||
; CHECK-NEXT: gc.statepoint
|
||||
merge:
|
||||
%bdv = phi i64 addrspace(1)* [ %obj, %entry ], [ %obj2, %taken ]
|
||||
call void @foo() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
||||
ret i64 addrspace(1)* %bdv
|
||||
}
|
||||
|
||||
define i64 addrspace(1)* @test4(i1 %cnd, i64 addrspace(1)* %obj, i64 addrspace(1)* %obj2) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test4
|
||||
; CHECK-LABEL: @test4(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: br i1 [[CND:%.*]], label [[MERGE:%.*]], label [[TAKEN:%.*]]
|
||||
; CHECK: taken:
|
||||
; CHECK-NEXT: br label [[MERGE]]
|
||||
; CHECK: merge:
|
||||
; CHECK-NEXT: [[BDV:%.*]] = phi i64 addrspace(1)* [ [[OBJ:%.*]], [[ENTRY:%.*]] ], [ [[OBJ]], [[TAKEN]] ]
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @foo, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(i64 addrspace(1)* [[BDV]], i64 addrspace(1)* [[OBJ]]) ]
|
||||
; CHECK-NEXT: [[BDV_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[BDV_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJ_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: ret i64 addrspace(1)* [[BDV_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
br i1 %cnd, label %merge, label %taken
|
||||
|
||||
taken: ; preds = %entry
|
||||
taken:
|
||||
br label %merge
|
||||
|
||||
merge: ; preds = %taken, %entry
|
||||
; CHECK-LABEL: merge:
|
||||
; CHECK-NEXT: phi
|
||||
; CHECK-NEXT: gc.statepoint
|
||||
merge:
|
||||
%bdv = phi i64 addrspace(1)* [ %obj, %entry ], [ %obj, %taken ]
|
||||
call void @foo() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
||||
ret i64 addrspace(1)* %bdv
|
||||
}
|
||||
|
||||
define i64 addrspace(1)* @test5(i1 %cnd, i64 addrspace(1)* %obj, i64 addrspace(1)* %obj2) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test5
|
||||
; CHECK-LABEL: @test5(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: br label [[MERGE:%.*]]
|
||||
; CHECK: merge:
|
||||
; CHECK-NEXT: [[BDV_BASE:%.*]] = phi i64 addrspace(1)* [ [[OBJ:%.*]], [[ENTRY:%.*]] ], [ [[OBJ2:%.*]], [[MERGE]] ], !is_base_value !0
|
||||
; CHECK-NEXT: [[BDV:%.*]] = phi i64 addrspace(1)* [ [[OBJ]], [[ENTRY]] ], [ [[OBJ2]], [[MERGE]] ]
|
||||
; CHECK-NEXT: br i1 [[CND:%.*]], label [[MERGE]], label [[NEXT:%.*]]
|
||||
; CHECK: next:
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @foo, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(i64 addrspace(1)* [[BDV]], i64 addrspace(1)* [[BDV_BASE]]) ]
|
||||
; CHECK-NEXT: [[BDV_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[BDV_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[BDV_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[BDV_BASE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: ret i64 addrspace(1)* [[BDV_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
br label %merge
|
||||
|
||||
merge: ; preds = %merge, %entry
|
||||
; CHECK-LABEL: merge:
|
||||
; CHECK-NEXT: phi
|
||||
; CHECK-NEXT: phi
|
||||
; CHECK-NEXT: br i1
|
||||
merge:
|
||||
%bdv = phi i64 addrspace(1)* [ %obj, %entry ], [ %obj2, %merge ]
|
||||
br i1 %cnd, label %merge, label %next
|
||||
|
||||
next: ; preds = %merge
|
||||
next:
|
||||
call void @foo() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
||||
ret i64 addrspace(1)* %bdv
|
||||
}
|
||||
|
@ -156,18 +226,26 @@ next: ; preds = %merge
|
|||
; result can avoid materializing the extra copy of the BDV phi node.
|
||||
; (Even without a general forward analysis)
|
||||
define i64 addrspace(1)* @test6(i1 %cnd, i64 addrspace(1)* %obj, i64 addrspace(1)* %obj2) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test6
|
||||
; CHECK-LABEL: @test6(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: br label [[MERGE:%.*]]
|
||||
; CHECK: merge:
|
||||
; CHECK-NEXT: [[BDV:%.*]] = phi i64 addrspace(1)* [ [[OBJ:%.*]], [[ENTRY:%.*]] ], [ [[OBJ2:%.*]], [[MERGE]] ]
|
||||
; CHECK-NEXT: br i1 [[CND:%.*]], label [[MERGE]], label [[NEXT:%.*]]
|
||||
; CHECK: next:
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @foo, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i64 addrspace(1)* [[BDV]]), "gc-live"(i64 addrspace(1)* [[BDV]]) ]
|
||||
; CHECK-NEXT: [[BDV_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 0, i32 0)
|
||||
; CHECK-NEXT: [[BDV_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: ret i64 addrspace(1)* [[BDV_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
br label %merge
|
||||
|
||||
merge: ; preds = %merge, %entry
|
||||
; CHECK-LABEL: merge:
|
||||
; CHECK-NEXT: phi
|
||||
; CHECK-NEXT: br i1
|
||||
merge:
|
||||
%bdv = phi i64 addrspace(1)* [ %obj, %entry ], [ %obj2, %merge ]
|
||||
br i1 %cnd, label %merge, label %next
|
||||
|
||||
next: ; preds = %merge
|
||||
next:
|
||||
call void @foo() [ "deopt"(i64 addrspace(1)* %bdv) ]
|
||||
ret i64 addrspace(1)* %bdv
|
||||
}
|
||||
|
|
|
@ -1,16 +1,20 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt < %s -rewrite-statepoints-for-gc -S | FileCheck %s
|
||||
; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S | FileCheck %s
|
||||
|
||||
|
||||
define i64 addrspace(1)* @test(<2 x i64 addrspace(1)*> %vec, i32 %idx) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test
|
||||
; CHECK: extractelement
|
||||
; CHECK: extractelement
|
||||
; CHECK: statepoint
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: ; (%base_ee, %obj)
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: ; (%base_ee, %base_ee)
|
||||
; CHECK-LABEL: @test(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[BASE_EE:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC:%.*]], i32 [[IDX:%.*]], !is_base_value !0
|
||||
; CHECK-NEXT: [[OBJ:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC]], i32 [[IDX]]
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(i64 addrspace(1)* [[OBJ]], i64 addrspace(1)* [[BASE_EE]]) ]
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJ_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[BASE_EE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[BASE_EE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BASE_EE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: ret i64 addrspace(1)* [[OBJ_RELOCATED_CASTED]]
|
||||
;
|
||||
; Note that the second extractelement is actually redundant here. A correct output would
|
||||
; be to reuse the existing obj as a base since it is actually a base pointer.
|
||||
entry:
|
||||
|
@ -20,7 +24,37 @@ entry:
|
|||
}
|
||||
|
||||
define i64 addrspace(1)* @test2(<2 x i64 addrspace(1)*>* %ptr, i1 %cnd, i32 %idx1, i32 %idx2) gc "statepoint-example" {
|
||||
; CHECK-LABEL: test2
|
||||
; CHECK-LABEL: @test2(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: br i1 [[CND:%.*]], label [[TAKEN:%.*]], label [[UNTAKEN:%.*]]
|
||||
; CHECK: taken:
|
||||
; CHECK-NEXT: [[OBJA:%.*]] = load <2 x i64 addrspace(1)*>, <2 x i64 addrspace(1)*>* [[PTR:%.*]], align 16
|
||||
; CHECK-NEXT: br label [[MERGE:%.*]]
|
||||
; CHECK: untaken:
|
||||
; CHECK-NEXT: [[OBJB:%.*]] = load <2 x i64 addrspace(1)*>, <2 x i64 addrspace(1)*>* [[PTR]], align 16
|
||||
; CHECK-NEXT: br label [[MERGE]]
|
||||
; CHECK: merge:
|
||||
; CHECK-NEXT: [[VEC_BASE:%.*]] = phi <2 x i64 addrspace(1)*> [ [[OBJA]], [[TAKEN]] ], [ [[OBJB]], [[UNTAKEN]] ], !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC:%.*]] = phi <2 x i64 addrspace(1)*> [ [[OBJA]], [[TAKEN]] ], [ [[OBJB]], [[UNTAKEN]] ]
|
||||
; CHECK-NEXT: br i1 [[CND]], label [[TAKEN2:%.*]], label [[UNTAKEN2:%.*]]
|
||||
; CHECK: taken2:
|
||||
; CHECK-NEXT: [[OBJ0_BASE:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC_BASE]], i32 [[IDX1:%.*]], !is_base_value !0
|
||||
; CHECK-NEXT: [[OBJ0:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC]], i32 [[IDX1]]
|
||||
; CHECK-NEXT: br label [[MERGE2:%.*]]
|
||||
; CHECK: untaken2:
|
||||
; CHECK-NEXT: [[OBJ1_BASE:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC_BASE]], i32 [[IDX2:%.*]], !is_base_value !0
|
||||
; CHECK-NEXT: [[OBJ1:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC]], i32 [[IDX2]]
|
||||
; CHECK-NEXT: br label [[MERGE2]]
|
||||
; CHECK: merge2:
|
||||
; CHECK-NEXT: [[OBJ_BASE:%.*]] = phi i64 addrspace(1)* [ [[OBJ0_BASE]], [[TAKEN2]] ], [ [[OBJ1_BASE]], [[UNTAKEN2]] ], !is_base_value !0
|
||||
; CHECK-NEXT: [[OBJ:%.*]] = phi i64 addrspace(1)* [ [[OBJ0]], [[TAKEN2]] ], [ [[OBJ1]], [[UNTAKEN2]] ]
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(i64 addrspace(1)* [[OBJ]], i64 addrspace(1)* [[OBJ_BASE]]) ]
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJ_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[OBJ_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[OBJ_BASE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJ_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: ret i64 addrspace(1)* [[OBJ_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
br i1 %cnd, label %taken, label %untaken
|
||||
|
||||
|
@ -45,26 +79,25 @@ untaken2: ; preds = %merge
|
|||
br label %merge2
|
||||
|
||||
merge2: ; preds = %untaken2, %taken2
|
||||
; CHECK-LABEL: merge2:
|
||||
; CHECK: %obj.base = phi i64 addrspace(1)*
|
||||
; CHECK: %obj = phi i64 addrspace(1)*
|
||||
; CHECK: statepoint
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: ; (%obj.base, %obj)
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: ; (%obj.base, %obj.base)
|
||||
%obj = phi i64 addrspace(1)* [ %obj0, %taken2 ], [ %obj1, %untaken2 ]
|
||||
call void @do_safepoint() [ "deopt"() ]
|
||||
ret i64 addrspace(1)* %obj
|
||||
}
|
||||
|
||||
define i64 addrspace(1)* @test3(i64 addrspace(1)* %ptr) gc "statepoint-example" {
|
||||
; CHECK-LABEL: test3
|
||||
; CHECK: insertelement
|
||||
; CHECK: extractelement
|
||||
; CHECK: statepoint
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: (%obj.base, %obj)
|
||||
; CHECK-LABEL: @test3(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[VEC_BASE:%.*]] = insertelement <2 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[PTR:%.*]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC:%.*]] = insertelement <2 x i64 addrspace(1)*> poison, i64 addrspace(1)* [[PTR]], i32 0
|
||||
; CHECK-NEXT: [[OBJ_BASE:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC_BASE]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[OBJ:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC]], i32 0
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(i64 addrspace(1)* [[OBJ]], i64 addrspace(1)* [[OBJ_BASE]]) ]
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJ_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[OBJ_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[OBJ_BASE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJ_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: ret i64 addrspace(1)* [[OBJ_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
%vec = insertelement <2 x i64 addrspace(1)*> poison, i64 addrspace(1)* %ptr, i32 0
|
||||
%obj = extractelement <2 x i64 addrspace(1)*> %vec, i32 0
|
||||
|
@ -73,10 +106,22 @@ entry:
|
|||
}
|
||||
|
||||
define i64 addrspace(1)* @test4(i64 addrspace(1)* %ptr) gc "statepoint-example" {
|
||||
; CHECK-LABEL: test4
|
||||
; CHECK: statepoint
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: ; (%obj.base, %obj)
|
||||
; CHECK-LABEL: @test4(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[DERIVED:%.*]] = getelementptr i64, i64 addrspace(1)* [[PTR:%.*]], i64 16
|
||||
; CHECK-NEXT: [[VECA_BASE:%.*]] = insertelement <2 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[PTR]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[VECA:%.*]] = insertelement <2 x i64 addrspace(1)*> poison, i64 addrspace(1)* [[DERIVED]], i32 0
|
||||
; CHECK-NEXT: [[VEC_BASE:%.*]] = insertelement <2 x i64 addrspace(1)*> [[VECA_BASE]], i64 addrspace(1)* [[PTR]], i32 1, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC:%.*]] = insertelement <2 x i64 addrspace(1)*> [[VECA]], i64 addrspace(1)* [[PTR]], i32 1
|
||||
; CHECK-NEXT: [[OBJ_BASE:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC_BASE]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[OBJ:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC]], i32 0
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(i64 addrspace(1)* [[OBJ]], i64 addrspace(1)* [[OBJ_BASE]]) ]
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJ_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[OBJ_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[OBJ_BASE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJ_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: ret i64 addrspace(1)* [[OBJ_RELOCATED_CASTED]]
|
||||
;
|
||||
; When we can optimize an extractelement from a known
|
||||
; index and avoid introducing new base pointer instructions
|
||||
entry:
|
||||
|
@ -92,9 +137,21 @@ declare void @use(i64 addrspace(1)*) "gc-leaf-function"
|
|||
declare void @use_vec(<4 x i64 addrspace(1)*>) "gc-leaf-function"
|
||||
|
||||
define void @test5(i1 %cnd, i64 addrspace(1)* %obj) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test5
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: (%bdv.base, %bdv)
|
||||
; CHECK-LABEL: @test5(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[GEP:%.*]] = getelementptr i64, i64 addrspace(1)* [[OBJ:%.*]], i64 1
|
||||
; CHECK-NEXT: [[VEC_BASE:%.*]] = insertelement <2 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[OBJ]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC:%.*]] = insertelement <2 x i64 addrspace(1)*> poison, i64 addrspace(1)* [[GEP]], i32 0
|
||||
; CHECK-NEXT: [[BDV_BASE:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC_BASE]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[BDV:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC]], i32 0
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(i64 addrspace(1)* [[BDV]], i64 addrspace(1)* [[BDV_BASE]]) ]
|
||||
; CHECK-NEXT: [[BDV_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[BDV_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[BDV_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[BDV_BASE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: call void @use(i64 addrspace(1)* [[BDV_RELOCATED_CASTED]])
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
; When we fundementally have to duplicate
|
||||
entry:
|
||||
%gep = getelementptr i64, i64 addrspace(1)* %obj, i64 1
|
||||
|
@ -106,15 +163,21 @@ entry:
|
|||
}
|
||||
|
||||
define void @test6(i1 %cnd, i64 addrspace(1)* %obj, i64 %idx) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test6
|
||||
; CHECK: %gep = getelementptr i64, i64 addrspace(1)* %obj, i64 1
|
||||
; CHECK: %vec.base = insertelement <2 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* %obj, i32 0, !is_base_value !0
|
||||
; CHECK: %vec = insertelement <2 x i64 addrspace(1)*> poison, i64 addrspace(1)* %gep, i32 0
|
||||
; CHECK: %bdv.base = extractelement <2 x i64 addrspace(1)*> %vec.base, i64 %idx, !is_base_value !0
|
||||
; CHECK: %bdv = extractelement <2 x i64 addrspace(1)*> %vec, i64 %idx
|
||||
; CHECK: gc.statepoint
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: (%bdv.base, %bdv)
|
||||
; CHECK-LABEL: @test6(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[GEP:%.*]] = getelementptr i64, i64 addrspace(1)* [[OBJ:%.*]], i64 1
|
||||
; CHECK-NEXT: [[VEC_BASE:%.*]] = insertelement <2 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[OBJ]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC:%.*]] = insertelement <2 x i64 addrspace(1)*> poison, i64 addrspace(1)* [[GEP]], i32 0
|
||||
; CHECK-NEXT: [[BDV_BASE:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC_BASE]], i64 [[IDX:%.*]], !is_base_value !0
|
||||
; CHECK-NEXT: [[BDV:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC]], i64 [[IDX]]
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(i64 addrspace(1)* [[BDV]], i64 addrspace(1)* [[BDV_BASE]]) ]
|
||||
; CHECK-NEXT: [[BDV_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[BDV_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[BDV_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[BDV_BASE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: call void @use(i64 addrspace(1)* [[BDV_RELOCATED_CASTED]])
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
; A more complicated example involving vector and scalar bases.
|
||||
; This is derived from a failing test case when we didn't have correct
|
||||
; insertelement handling.
|
||||
|
@ -128,37 +191,49 @@ entry:
|
|||
}
|
||||
|
||||
define i64 addrspace(1)* @test7(i1 %cnd, i64 addrspace(1)* %obj, i64 addrspace(1)* %obj2) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test7
|
||||
; CHECK-LABEL: @test7(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[VEC_BASE:%.*]] = insertelement <2 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[OBJ2:%.*]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC:%.*]] = insertelement <2 x i64 addrspace(1)*> poison, i64 addrspace(1)* [[OBJ2]], i32 0
|
||||
; CHECK-NEXT: br label [[MERGE1:%.*]]
|
||||
; CHECK: merge1:
|
||||
; CHECK-NEXT: [[VEC2_BASE:%.*]] = phi <2 x i64 addrspace(1)*> [ [[VEC_BASE]], [[ENTRY:%.*]] ], [ [[VEC3_BASE:%.*]], [[MERGE1]] ], !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC2:%.*]] = phi <2 x i64 addrspace(1)*> [ [[VEC]], [[ENTRY]] ], [ [[VEC3:%.*]], [[MERGE1]] ]
|
||||
; CHECK-NEXT: [[GEP:%.*]] = getelementptr i64, i64 addrspace(1)* [[OBJ2]], i64 1
|
||||
; CHECK-NEXT: [[VEC3_BASE]] = insertelement <2 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[OBJ2]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC3]] = insertelement <2 x i64 addrspace(1)*> poison, i64 addrspace(1)* [[GEP]], i32 0
|
||||
; CHECK-NEXT: br i1 [[CND:%.*]], label [[MERGE1]], label [[NEXT1:%.*]]
|
||||
; CHECK: next1:
|
||||
; CHECK-NEXT: [[BDV_BASE:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC2_BASE]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[BDV:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC2]], i32 0
|
||||
; CHECK-NEXT: br label [[MERGE:%.*]]
|
||||
; CHECK: merge:
|
||||
; CHECK-NEXT: [[OBJB_BASE:%.*]] = phi i64 addrspace(1)* [ [[OBJ:%.*]], [[NEXT1]] ], [ [[BDV_BASE]], [[MERGE]] ], !is_base_value !0
|
||||
; CHECK-NEXT: [[OBJB:%.*]] = phi i64 addrspace(1)* [ [[OBJ]], [[NEXT1]] ], [ [[BDV]], [[MERGE]] ]
|
||||
; CHECK-NEXT: br i1 [[CND]], label [[MERGE]], label [[NEXT:%.*]]
|
||||
; CHECK: next:
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(i64 addrspace(1)* [[OBJB]], i64 addrspace(1)* [[OBJB_BASE]]) ]
|
||||
; CHECK-NEXT: [[OBJB_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[OBJB_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJB_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[OBJB_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[OBJB_BASE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJB_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: ret i64 addrspace(1)* [[OBJB_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
%vec = insertelement <2 x i64 addrspace(1)*> poison, i64 addrspace(1)* %obj2, i32 0
|
||||
br label %merge1
|
||||
|
||||
merge1: ; preds = %merge1, %entry
|
||||
; CHECK-LABEL: merge1:
|
||||
; CHECK: vec2.base
|
||||
; CHECK: vec2
|
||||
; CHECK: gep
|
||||
; CHECK: vec3.base
|
||||
; CHECK: vec3
|
||||
%vec2 = phi <2 x i64 addrspace(1)*> [ %vec, %entry ], [ %vec3, %merge1 ]
|
||||
%gep = getelementptr i64, i64 addrspace(1)* %obj2, i64 1
|
||||
%vec3 = insertelement <2 x i64 addrspace(1)*> poison, i64 addrspace(1)* %gep, i32 0
|
||||
br i1 %cnd, label %merge1, label %next1
|
||||
|
||||
next1: ; preds = %merge1
|
||||
; CHECK-LABEL: next1:
|
||||
; CHECK: bdv.base =
|
||||
; CHECK: bdv =
|
||||
%bdv = extractelement <2 x i64 addrspace(1)*> %vec2, i32 0
|
||||
br label %merge
|
||||
|
||||
merge: ; preds = %merge, %next1
|
||||
; CHECK-LABEL: merge:
|
||||
; CHECK: %objb.base
|
||||
; CHECK: %objb
|
||||
; CHECK: gc.statepoint
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: (%objb.base, %objb)
|
||||
%objb = phi i64 addrspace(1)* [ %obj, %next1 ], [ %bdv, %merge ]
|
||||
br i1 %cnd, label %merge, label %next
|
||||
|
||||
|
@ -169,20 +244,26 @@ next: ; preds = %merge
|
|||
|
||||
; identify base for shufflevector
|
||||
define void @test8(i64 addrspace(1)* %obj, i64 %idx) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test8
|
||||
; CHECK: %gep = getelementptr i64, i64 addrspace(1)* %obj, i64 1
|
||||
; CHECK: %gep2 = getelementptr i64, i64 addrspace(1)* %obj, i64 2
|
||||
; CHECK: %vec1.base = insertelement <4 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* %obj, i32 0, !is_base_value !0
|
||||
; CHECK: %vec1 = insertelement <4 x i64 addrspace(1)*> poison, i64 addrspace(1)* %gep, i32 0
|
||||
; CHECK: %vec2.base = insertelement <4 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* %obj, i32 2, !is_base_value !0
|
||||
; CHECK: %vec2 = insertelement <4 x i64 addrspace(1)*> poison, i64 addrspace(1)* %gep2, i32 2
|
||||
; CHECK: %vec.base = shufflevector <4 x i64 addrspace(1)*> %vec1.base, <4 x i64 addrspace(1)*> %vec2.base, <2 x i32> <i32 0, i32 2>, !is_base_value !0
|
||||
; CHECK: %vec = shufflevector <4 x i64 addrspace(1)*> %vec1, <4 x i64 addrspace(1)*> %vec2, <2 x i32> <i32 0, i32 2>
|
||||
; CHECK: %bdv.base = extractelement <2 x i64 addrspace(1)*> %vec.base, i64 %idx, !is_base_value !0
|
||||
; CHECK: %bdv = extractelement <2 x i64 addrspace(1)*> %vec, i64 %idx
|
||||
; CHECK: gc.statepoint
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: (%bdv.base, %bdv)
|
||||
; CHECK-LABEL: @test8(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[GEP:%.*]] = getelementptr i64, i64 addrspace(1)* [[OBJ:%.*]], i64 1
|
||||
; CHECK-NEXT: [[GEP2:%.*]] = getelementptr i64, i64 addrspace(1)* [[OBJ]], i64 2
|
||||
; CHECK-NEXT: [[VEC1_BASE:%.*]] = insertelement <4 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[OBJ]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC1:%.*]] = insertelement <4 x i64 addrspace(1)*> poison, i64 addrspace(1)* [[GEP]], i32 0
|
||||
; CHECK-NEXT: [[VEC2_BASE:%.*]] = insertelement <4 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[OBJ]], i32 2, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC2:%.*]] = insertelement <4 x i64 addrspace(1)*> poison, i64 addrspace(1)* [[GEP2]], i32 2
|
||||
; CHECK-NEXT: [[VEC_BASE:%.*]] = shufflevector <4 x i64 addrspace(1)*> [[VEC1_BASE]], <4 x i64 addrspace(1)*> [[VEC2_BASE]], <2 x i32> <i32 0, i32 2>, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC:%.*]] = shufflevector <4 x i64 addrspace(1)*> [[VEC1]], <4 x i64 addrspace(1)*> [[VEC2]], <2 x i32> <i32 0, i32 2>
|
||||
; CHECK-NEXT: [[BDV_BASE:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC_BASE]], i64 [[IDX:%.*]], !is_base_value !0
|
||||
; CHECK-NEXT: [[BDV:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC]], i64 [[IDX]]
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(i64 addrspace(1)* [[BDV]], i64 addrspace(1)* [[BDV_BASE]]) ]
|
||||
; CHECK-NEXT: [[BDV_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[BDV_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[BDV_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[BDV_BASE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: call void @use(i64 addrspace(1)* [[BDV_RELOCATED_CASTED]])
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
entry:
|
||||
%gep = getelementptr i64, i64 addrspace(1)* %obj, i64 1
|
||||
%gep2 = getelementptr i64, i64 addrspace(1)* %obj, i64 2
|
||||
|
@ -198,15 +279,21 @@ entry:
|
|||
; Since the same 'base' vector is used in the shuffle operands, we do not need
|
||||
; create a shufflevector base.
|
||||
define void @test9(<4 x i64 addrspace(1)*> %vec1, i64 %idx) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test9
|
||||
; CHECK: %vec = shufflevector <4 x i64 addrspace(1)*> %vec1, <4 x i64 addrspace(1)*> %vec1, <2 x i32> <i32 0, i32 2>
|
||||
; CHECK: %base_ee = extractelement <4 x i64 addrspace(1)*> %vec1, i64 %idx, !is_base_value !0
|
||||
; CHECK: %bdv = extractelement <2 x i64 addrspace(1)*> %vec, i64 %idx
|
||||
; CHECK: gc.statepoint
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: (%base_ee, %bdv)
|
||||
; CHECK-LABEL: @test9(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[VEC:%.*]] = shufflevector <4 x i64 addrspace(1)*> [[VEC1:%.*]], <4 x i64 addrspace(1)*> [[VEC1]], <2 x i32> <i32 0, i32 2>
|
||||
; CHECK-NEXT: [[BASE_EE:%.*]] = extractelement <4 x i64 addrspace(1)*> [[VEC1]], i64 [[IDX:%.*]], !is_base_value !0
|
||||
; CHECK-NEXT: [[BDV:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC]], i64 [[IDX]]
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(i64 addrspace(1)* [[BDV]], i64 addrspace(1)* [[BASE_EE]]) ]
|
||||
; CHECK-NEXT: [[BDV_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[BDV_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[BASE_EE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[BASE_EE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BASE_EE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: call void @use(i64 addrspace(1)* [[BDV_RELOCATED_CASTED]])
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
entry:
|
||||
; shrinking vec1 into vec
|
||||
; shrinking vec1 into vec
|
||||
%vec = shufflevector <4 x i64 addrspace(1)*> %vec1, <4 x i64 addrspace(1)*> %vec1, <2 x i32> <i32 0, i32 2>
|
||||
%bdv = extractelement <2 x i64 addrspace(1)*> %vec, i64 %idx
|
||||
call void @do_safepoint() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
||||
|
@ -216,7 +303,31 @@ entry:
|
|||
|
||||
; vector operand of shufflevector is a phi
|
||||
define i64 addrspace(1)* @test10(i1 %cnd, i64 addrspace(1)* %obj, i64 addrspace(1)* %obj2) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test10
|
||||
; CHECK-LABEL: @test10(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[VEC1_BASE:%.*]] = insertelement <4 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[OBJ:%.*]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC1:%.*]] = insertelement <4 x i64 addrspace(1)*> poison, i64 addrspace(1)* [[OBJ]], i32 0
|
||||
; CHECK-NEXT: br i1 [[CND:%.*]], label [[HERE:%.*]], label [[MERGE:%.*]]
|
||||
; CHECK: here:
|
||||
; CHECK-NEXT: [[VEC2_BASE:%.*]] = insertelement <4 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[OBJ2:%.*]], i32 2, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC2:%.*]] = insertelement <4 x i64 addrspace(1)*> poison, i64 addrspace(1)* [[OBJ2]], i32 2
|
||||
; CHECK-NEXT: br label [[MERGE]]
|
||||
; CHECK: merge:
|
||||
; CHECK-NEXT: [[VEC_BASE:%.*]] = phi <4 x i64 addrspace(1)*> [ [[VEC1_BASE]], [[ENTRY:%.*]] ], [ [[VEC2_BASE]], [[HERE]] ], [ [[VEC3_BASE:%.*]], [[MERGE]] ], !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC:%.*]] = phi <4 x i64 addrspace(1)*> [ [[VEC1]], [[ENTRY]] ], [ [[VEC2]], [[HERE]] ], [ [[VEC3:%.*]], [[MERGE]] ]
|
||||
; CHECK-NEXT: [[VEC3_BASE]] = shufflevector <4 x i64 addrspace(1)*> [[VEC_BASE]], <4 x i64 addrspace(1)*> [[VEC_BASE]], <4 x i32> <i32 2, i32 0, i32 1, i32 3>, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC3]] = shufflevector <4 x i64 addrspace(1)*> [[VEC]], <4 x i64 addrspace(1)*> [[VEC]], <4 x i32> <i32 2, i32 0, i32 1, i32 3>
|
||||
; CHECK-NEXT: [[BDV_BASE:%.*]] = extractelement <4 x i64 addrspace(1)*> [[VEC3_BASE]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[BDV:%.*]] = extractelement <4 x i64 addrspace(1)*> [[VEC3]], i32 0
|
||||
; CHECK-NEXT: br i1 [[CND]], label [[MERGE]], label [[NEXT:%.*]]
|
||||
; CHECK: next:
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(i64 addrspace(1)* [[BDV]], i64 addrspace(1)* [[BDV_BASE]]) ]
|
||||
; CHECK-NEXT: [[BDV_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[BDV_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[BDV_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[BDV_BASE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: ret i64 addrspace(1)* [[BDV_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
%vec1 = insertelement <4 x i64 addrspace(1)*> poison, i64 addrspace(1)* %obj, i32 0
|
||||
br i1 %cnd, label %here, label %merge
|
||||
|
@ -226,23 +337,12 @@ here:
|
|||
br label %merge
|
||||
|
||||
merge: ; preds = %merge, %entry, %here
|
||||
; CHECK-LABEL: merge:
|
||||
; CHECK: %vec.base = phi <4 x i64 addrspace(1)*> [ %vec1.base, %entry ], [ %vec2.base, %here ], [ %vec3.base, %merge ], !is_base_value !0
|
||||
; CHECK: vec
|
||||
; CHECK: vec3.base = shufflevector <4 x i64 addrspace(1)*> %vec.base, <4 x i64 addrspace(1)*> %vec.base
|
||||
; CHECK: vec3
|
||||
; CHECK: bdv.base
|
||||
; CHECK: bdv
|
||||
%vec = phi <4 x i64 addrspace(1)*> [ %vec1, %entry ], [ %vec2, %here], [ %vec3, %merge]
|
||||
%vec3 = shufflevector <4 x i64 addrspace(1)*> %vec, <4 x i64 addrspace(1)*> %vec, <4 x i32> <i32 2, i32 0, i32 1, i32 3>
|
||||
%bdv = extractelement <4 x i64 addrspace(1)*> %vec3, i32 0
|
||||
br i1 %cnd, label %merge, label %next
|
||||
|
||||
next:
|
||||
; CHECK-LABEL: next:
|
||||
; CHECK: gc.statepoint
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: (%bdv.base, %bdv)
|
||||
call void @do_safepoint() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
||||
ret i64 addrspace(1)* %bdv
|
||||
}
|
||||
|
@ -250,11 +350,15 @@ declare void @do_safepoint()
|
|||
|
||||
define void @test11(<4 x i64 addrspace(1)*> %vec1) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test11(
|
||||
; CHECK: @llvm.experimental.gc.statepoint.p0f_isVoidf{{.*}}<4 x i64 addrspace(1)*> %vec1)
|
||||
; CHECK: %vec1.relocated = call coldcc <4 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v4p1i8
|
||||
; CHECK: %vec1.relocated.casted = bitcast <4 x i8 addrspace(1)*> %vec1.relocated to <4 x i64 addrspace(1)*>
|
||||
; CHECK: %vec2.remat = getelementptr i64, <4 x i64 addrspace(1)*> %vec1.relocated.casted, i32 1024
|
||||
; CHECK: call void @use_vec(<4 x i64 addrspace(1)*> %vec2.remat)
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[VEC2:%.*]] = getelementptr i64, <4 x i64 addrspace(1)*> [[VEC1:%.*]], i32 1024
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(<4 x i64 addrspace(1)*> [[VEC1]]) ]
|
||||
; CHECK-NEXT: [[VEC1_RELOCATED:%.*]] = call coldcc <4 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v4p1i8(token [[STATEPOINT_TOKEN]], i32 0, i32 0)
|
||||
; CHECK-NEXT: [[VEC1_RELOCATED_CASTED:%.*]] = bitcast <4 x i8 addrspace(1)*> [[VEC1_RELOCATED]] to <4 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: [[VEC2_REMAT:%.*]] = getelementptr i64, <4 x i64 addrspace(1)*> [[VEC1_RELOCATED_CASTED]], i32 1024
|
||||
; CHECK-NEXT: call void @use_vec(<4 x i64 addrspace(1)*> [[VEC2_REMAT]])
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
entry:
|
||||
%vec2 = getelementptr i64, <4 x i64 addrspace(1)*> %vec1, i32 1024
|
||||
call void @do_safepoint() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
||||
|
@ -266,11 +370,14 @@ declare <4 x i64 addrspace(1)*> @def_vec() "gc-leaf-function"
|
|||
|
||||
define void @test12(<4 x i64 addrspace(1)*> %vec1) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test12(
|
||||
; CHECK: @llvm.experimental.gc.statepoint.p0f_isVoidf{{.*}}<4 x i64 addrspace(1)*> %vec)
|
||||
; CHECK-NEXT: %vec.relocated = call coldcc <4 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v4p1i8(
|
||||
; CHECK-NEXT: %vec.relocated.casted = bitcast <4 x i8 addrspace(1)*> %vec.relocated to <4 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: call void @use_vec(<4 x i64 addrspace(1)*> %vec.relocated.casted)
|
||||
; CHECK-NEXT: ret void
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[VEC:%.*]] = call <4 x i64 addrspace(1)*> @def_vec()
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(<4 x i64 addrspace(1)*> [[VEC]]) ]
|
||||
; CHECK-NEXT: [[VEC_RELOCATED:%.*]] = call coldcc <4 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v4p1i8(token [[STATEPOINT_TOKEN]], i32 0, i32 0)
|
||||
; CHECK-NEXT: [[VEC_RELOCATED_CASTED:%.*]] = bitcast <4 x i8 addrspace(1)*> [[VEC_RELOCATED]] to <4 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: call void @use_vec(<4 x i64 addrspace(1)*> [[VEC_RELOCATED_CASTED]])
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
entry:
|
||||
%vec = call <4 x i64 addrspace(1)*> @def_vec()
|
||||
call void @do_safepoint() [ "deopt"() ]
|
||||
|
|
|
@ -1,18 +1,22 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt < %s -rewrite-statepoints-for-gc -S | FileCheck %s
|
||||
; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S | FileCheck %s
|
||||
|
||||
|
||||
define i64 addrspace(1)* @test(<2 x i64 addrspace(1)*> %vec, i32 %idx) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test
|
||||
; CHECK: extractelement
|
||||
; CHECK: extractelement
|
||||
; CHECK: statepoint
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: ; (%base_ee, %obj)
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: ; (%base_ee, %base_ee)
|
||||
; Note that the second extractelement is actually redundant here. A correct output would
|
||||
; be to reuse the existing obj as a base since it is actually a base pointer.
|
||||
; CHECK-LABEL: @test(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[BASE_EE:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC:%.*]], i32 [[IDX:%.*]], !is_base_value !0
|
||||
; CHECK-NEXT: [[OBJ:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC]], i32 [[IDX]]
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(i64 addrspace(1)* [[OBJ]], i64 addrspace(1)* [[BASE_EE]]) ]
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJ_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[BASE_EE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[BASE_EE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BASE_EE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: ret i64 addrspace(1)* [[OBJ_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
%obj = extractelement <2 x i64 addrspace(1)*> %vec, i32 %idx
|
||||
call void @do_safepoint() [ "deopt"() ]
|
||||
|
@ -20,7 +24,37 @@ entry:
|
|||
}
|
||||
|
||||
define i64 addrspace(1)* @test2(<2 x i64 addrspace(1)*>* %ptr, i1 %cnd, i32 %idx1, i32 %idx2) gc "statepoint-example" {
|
||||
; CHECK-LABEL: test2
|
||||
; CHECK-LABEL: @test2(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: br i1 [[CND:%.*]], label [[TAKEN:%.*]], label [[UNTAKEN:%.*]]
|
||||
; CHECK: taken:
|
||||
; CHECK-NEXT: [[OBJA:%.*]] = load <2 x i64 addrspace(1)*>, <2 x i64 addrspace(1)*>* [[PTR:%.*]], align 16
|
||||
; CHECK-NEXT: br label [[MERGE:%.*]]
|
||||
; CHECK: untaken:
|
||||
; CHECK-NEXT: [[OBJB:%.*]] = load <2 x i64 addrspace(1)*>, <2 x i64 addrspace(1)*>* [[PTR]], align 16
|
||||
; CHECK-NEXT: br label [[MERGE]]
|
||||
; CHECK: merge:
|
||||
; CHECK-NEXT: [[VEC_BASE:%.*]] = phi <2 x i64 addrspace(1)*> [ [[OBJA]], [[TAKEN]] ], [ [[OBJB]], [[UNTAKEN]] ], !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC:%.*]] = phi <2 x i64 addrspace(1)*> [ [[OBJA]], [[TAKEN]] ], [ [[OBJB]], [[UNTAKEN]] ]
|
||||
; CHECK-NEXT: br i1 [[CND]], label [[TAKEN2:%.*]], label [[UNTAKEN2:%.*]]
|
||||
; CHECK: taken2:
|
||||
; CHECK-NEXT: [[OBJ0_BASE:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC_BASE]], i32 [[IDX1:%.*]], !is_base_value !0
|
||||
; CHECK-NEXT: [[OBJ0:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC]], i32 [[IDX1]]
|
||||
; CHECK-NEXT: br label [[MERGE2:%.*]]
|
||||
; CHECK: untaken2:
|
||||
; CHECK-NEXT: [[OBJ1_BASE:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC_BASE]], i32 [[IDX2:%.*]], !is_base_value !0
|
||||
; CHECK-NEXT: [[OBJ1:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC]], i32 [[IDX2]]
|
||||
; CHECK-NEXT: br label [[MERGE2]]
|
||||
; CHECK: merge2:
|
||||
; CHECK-NEXT: [[OBJ_BASE:%.*]] = phi i64 addrspace(1)* [ [[OBJ0_BASE]], [[TAKEN2]] ], [ [[OBJ1_BASE]], [[UNTAKEN2]] ], !is_base_value !0
|
||||
; CHECK-NEXT: [[OBJ:%.*]] = phi i64 addrspace(1)* [ [[OBJ0]], [[TAKEN2]] ], [ [[OBJ1]], [[UNTAKEN2]] ]
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(i64 addrspace(1)* [[OBJ]], i64 addrspace(1)* [[OBJ_BASE]]) ]
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJ_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[OBJ_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[OBJ_BASE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJ_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: ret i64 addrspace(1)* [[OBJ_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
br i1 %cnd, label %taken, label %untaken
|
||||
|
||||
|
@ -45,26 +79,25 @@ untaken2: ; preds = %merge
|
|||
br label %merge2
|
||||
|
||||
merge2: ; preds = %untaken2, %taken2
|
||||
; CHECK-LABEL: merge2:
|
||||
; CHECK: %obj.base = phi i64 addrspace(1)*
|
||||
; CHECK: %obj = phi i64 addrspace(1)*
|
||||
; CHECK: statepoint
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: ; (%obj.base, %obj)
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: ; (%obj.base, %obj.base)
|
||||
%obj = phi i64 addrspace(1)* [ %obj0, %taken2 ], [ %obj1, %untaken2 ]
|
||||
call void @do_safepoint() [ "deopt"() ]
|
||||
ret i64 addrspace(1)* %obj
|
||||
}
|
||||
|
||||
define i64 addrspace(1)* @test3(i64 addrspace(1)* %ptr) gc "statepoint-example" {
|
||||
; CHECK-LABEL: test3
|
||||
; CHECK: insertelement
|
||||
; CHECK: extractelement
|
||||
; CHECK: statepoint
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: (%obj.base, %obj)
|
||||
; CHECK-LABEL: @test3(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[VEC_BASE:%.*]] = insertelement <2 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[PTR:%.*]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC:%.*]] = insertelement <2 x i64 addrspace(1)*> undef, i64 addrspace(1)* [[PTR]], i32 0
|
||||
; CHECK-NEXT: [[OBJ_BASE:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC_BASE]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[OBJ:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC]], i32 0
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(i64 addrspace(1)* [[OBJ]], i64 addrspace(1)* [[OBJ_BASE]]) ]
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJ_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[OBJ_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[OBJ_BASE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJ_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: ret i64 addrspace(1)* [[OBJ_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
%vec = insertelement <2 x i64 addrspace(1)*> undef, i64 addrspace(1)* %ptr, i32 0
|
||||
%obj = extractelement <2 x i64 addrspace(1)*> %vec, i32 0
|
||||
|
@ -73,12 +106,24 @@ entry:
|
|||
}
|
||||
|
||||
define i64 addrspace(1)* @test4(i64 addrspace(1)* %ptr) gc "statepoint-example" {
|
||||
; CHECK-LABEL: test4
|
||||
; CHECK: statepoint
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: ; (%obj.base, %obj)
|
||||
; When we can optimize an extractelement from a known
|
||||
; index and avoid introducing new base pointer instructions
|
||||
; CHECK-LABEL: @test4(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[DERIVED:%.*]] = getelementptr i64, i64 addrspace(1)* [[PTR:%.*]], i64 16
|
||||
; CHECK-NEXT: [[VECA_BASE:%.*]] = insertelement <2 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[PTR]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[VECA:%.*]] = insertelement <2 x i64 addrspace(1)*> undef, i64 addrspace(1)* [[DERIVED]], i32 0
|
||||
; CHECK-NEXT: [[VEC_BASE:%.*]] = insertelement <2 x i64 addrspace(1)*> [[VECA_BASE]], i64 addrspace(1)* [[PTR]], i32 1, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC:%.*]] = insertelement <2 x i64 addrspace(1)*> [[VECA]], i64 addrspace(1)* [[PTR]], i32 1
|
||||
; CHECK-NEXT: [[OBJ_BASE:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC_BASE]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[OBJ:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC]], i32 0
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(i64 addrspace(1)* [[OBJ]], i64 addrspace(1)* [[OBJ_BASE]]) ]
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJ_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[OBJ_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[OBJ_BASE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJ_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: ret i64 addrspace(1)* [[OBJ_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
%derived = getelementptr i64, i64 addrspace(1)* %ptr, i64 16
|
||||
%veca = insertelement <2 x i64 addrspace(1)*> undef, i64 addrspace(1)* %derived, i32 0
|
||||
|
@ -92,10 +137,22 @@ declare void @use(i64 addrspace(1)*) "gc-leaf-function"
|
|||
declare void @use_vec(<4 x i64 addrspace(1)*>) "gc-leaf-function"
|
||||
|
||||
define void @test5(i1 %cnd, i64 addrspace(1)* %obj) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test5
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: (%bdv.base, %bdv)
|
||||
; When we fundementally have to duplicate
|
||||
; CHECK-LABEL: @test5(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[GEP:%.*]] = getelementptr i64, i64 addrspace(1)* [[OBJ:%.*]], i64 1
|
||||
; CHECK-NEXT: [[VEC_BASE:%.*]] = insertelement <2 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[OBJ]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC:%.*]] = insertelement <2 x i64 addrspace(1)*> undef, i64 addrspace(1)* [[GEP]], i32 0
|
||||
; CHECK-NEXT: [[BDV_BASE:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC_BASE]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[BDV:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC]], i32 0
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(i64 addrspace(1)* [[BDV]], i64 addrspace(1)* [[BDV_BASE]]) ]
|
||||
; CHECK-NEXT: [[BDV_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[BDV_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[BDV_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[BDV_BASE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: call void @use(i64 addrspace(1)* [[BDV_RELOCATED_CASTED]])
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
entry:
|
||||
%gep = getelementptr i64, i64 addrspace(1)* %obj, i64 1
|
||||
%vec = insertelement <2 x i64 addrspace(1)*> undef, i64 addrspace(1)* %gep, i32 0
|
||||
|
@ -106,18 +163,24 @@ entry:
|
|||
}
|
||||
|
||||
define void @test6(i1 %cnd, i64 addrspace(1)* %obj, i64 %idx) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test6
|
||||
; CHECK: %gep = getelementptr i64, i64 addrspace(1)* %obj, i64 1
|
||||
; CHECK: %vec.base = insertelement <2 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* %obj, i32 0, !is_base_value !0
|
||||
; CHECK: %vec = insertelement <2 x i64 addrspace(1)*> undef, i64 addrspace(1)* %gep, i32 0
|
||||
; CHECK: %bdv.base = extractelement <2 x i64 addrspace(1)*> %vec.base, i64 %idx, !is_base_value !0
|
||||
; CHECK: %bdv = extractelement <2 x i64 addrspace(1)*> %vec, i64 %idx
|
||||
; CHECK: gc.statepoint
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: (%bdv.base, %bdv)
|
||||
; A more complicated example involving vector and scalar bases.
|
||||
; This is derived from a failing test case when we didn't have correct
|
||||
; insertelement handling.
|
||||
; CHECK-LABEL: @test6(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[GEP:%.*]] = getelementptr i64, i64 addrspace(1)* [[OBJ:%.*]], i64 1
|
||||
; CHECK-NEXT: [[VEC_BASE:%.*]] = insertelement <2 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[OBJ]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC:%.*]] = insertelement <2 x i64 addrspace(1)*> undef, i64 addrspace(1)* [[GEP]], i32 0
|
||||
; CHECK-NEXT: [[BDV_BASE:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC_BASE]], i64 [[IDX:%.*]], !is_base_value !0
|
||||
; CHECK-NEXT: [[BDV:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC]], i64 [[IDX]]
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(i64 addrspace(1)* [[BDV]], i64 addrspace(1)* [[BDV_BASE]]) ]
|
||||
; CHECK-NEXT: [[BDV_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[BDV_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[BDV_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[BDV_BASE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: call void @use(i64 addrspace(1)* [[BDV_RELOCATED_CASTED]])
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
entry:
|
||||
%gep = getelementptr i64, i64 addrspace(1)* %obj, i64 1
|
||||
%vec = insertelement <2 x i64 addrspace(1)*> undef, i64 addrspace(1)* %gep, i32 0
|
||||
|
@ -128,37 +191,49 @@ entry:
|
|||
}
|
||||
|
||||
define i64 addrspace(1)* @test7(i1 %cnd, i64 addrspace(1)* %obj, i64 addrspace(1)* %obj2) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test7
|
||||
; CHECK-LABEL: @test7(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[VEC_BASE:%.*]] = insertelement <2 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[OBJ2:%.*]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC:%.*]] = insertelement <2 x i64 addrspace(1)*> undef, i64 addrspace(1)* [[OBJ2]], i32 0
|
||||
; CHECK-NEXT: br label [[MERGE1:%.*]]
|
||||
; CHECK: merge1:
|
||||
; CHECK-NEXT: [[VEC2_BASE:%.*]] = phi <2 x i64 addrspace(1)*> [ [[VEC_BASE]], [[ENTRY:%.*]] ], [ [[VEC3_BASE:%.*]], [[MERGE1]] ], !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC2:%.*]] = phi <2 x i64 addrspace(1)*> [ [[VEC]], [[ENTRY]] ], [ [[VEC3:%.*]], [[MERGE1]] ]
|
||||
; CHECK-NEXT: [[GEP:%.*]] = getelementptr i64, i64 addrspace(1)* [[OBJ2]], i64 1
|
||||
; CHECK-NEXT: [[VEC3_BASE]] = insertelement <2 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[OBJ2]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC3]] = insertelement <2 x i64 addrspace(1)*> undef, i64 addrspace(1)* [[GEP]], i32 0
|
||||
; CHECK-NEXT: br i1 [[CND:%.*]], label [[MERGE1]], label [[NEXT1:%.*]]
|
||||
; CHECK: next1:
|
||||
; CHECK-NEXT: [[BDV_BASE:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC2_BASE]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[BDV:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC2]], i32 0
|
||||
; CHECK-NEXT: br label [[MERGE:%.*]]
|
||||
; CHECK: merge:
|
||||
; CHECK-NEXT: [[OBJB_BASE:%.*]] = phi i64 addrspace(1)* [ [[OBJ:%.*]], [[NEXT1]] ], [ [[BDV_BASE]], [[MERGE]] ], !is_base_value !0
|
||||
; CHECK-NEXT: [[OBJB:%.*]] = phi i64 addrspace(1)* [ [[OBJ]], [[NEXT1]] ], [ [[BDV]], [[MERGE]] ]
|
||||
; CHECK-NEXT: br i1 [[CND]], label [[MERGE]], label [[NEXT:%.*]]
|
||||
; CHECK: next:
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(i64 addrspace(1)* [[OBJB]], i64 addrspace(1)* [[OBJB_BASE]]) ]
|
||||
; CHECK-NEXT: [[OBJB_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[OBJB_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJB_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[OBJB_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[OBJB_BASE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJB_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: ret i64 addrspace(1)* [[OBJB_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
%vec = insertelement <2 x i64 addrspace(1)*> undef, i64 addrspace(1)* %obj2, i32 0
|
||||
br label %merge1
|
||||
|
||||
merge1: ; preds = %merge1, %entry
|
||||
; CHECK-LABEL: merge1:
|
||||
; CHECK: vec2.base
|
||||
; CHECK: vec2
|
||||
; CHECK: gep
|
||||
; CHECK: vec3.base
|
||||
; CHECK: vec3
|
||||
%vec2 = phi <2 x i64 addrspace(1)*> [ %vec, %entry ], [ %vec3, %merge1 ]
|
||||
%gep = getelementptr i64, i64 addrspace(1)* %obj2, i64 1
|
||||
%vec3 = insertelement <2 x i64 addrspace(1)*> undef, i64 addrspace(1)* %gep, i32 0
|
||||
br i1 %cnd, label %merge1, label %next1
|
||||
|
||||
next1: ; preds = %merge1
|
||||
; CHECK-LABEL: next1:
|
||||
; CHECK: bdv.base =
|
||||
; CHECK: bdv =
|
||||
%bdv = extractelement <2 x i64 addrspace(1)*> %vec2, i32 0
|
||||
br label %merge
|
||||
|
||||
merge: ; preds = %merge, %next1
|
||||
; CHECK-LABEL: merge:
|
||||
; CHECK: %objb.base
|
||||
; CHECK: %objb
|
||||
; CHECK: gc.statepoint
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: (%objb.base, %objb)
|
||||
%objb = phi i64 addrspace(1)* [ %obj, %next1 ], [ %bdv, %merge ]
|
||||
br i1 %cnd, label %merge, label %next
|
||||
|
||||
|
@ -169,20 +244,26 @@ next: ; preds = %merge
|
|||
|
||||
; identify base for shufflevector
|
||||
define void @test8(i64 addrspace(1)* %obj, i64 %idx) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test8
|
||||
; CHECK: %gep = getelementptr i64, i64 addrspace(1)* %obj, i64 1
|
||||
; CHECK: %gep2 = getelementptr i64, i64 addrspace(1)* %obj, i64 2
|
||||
; CHECK: %vec1.base = insertelement <4 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* %obj, i32 0, !is_base_value !0
|
||||
; CHECK: %vec1 = insertelement <4 x i64 addrspace(1)*> undef, i64 addrspace(1)* %gep, i32 0
|
||||
; CHECK: %vec2.base = insertelement <4 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* %obj, i32 2, !is_base_value !0
|
||||
; CHECK: %vec2 = insertelement <4 x i64 addrspace(1)*> undef, i64 addrspace(1)* %gep2, i32 2
|
||||
; CHECK: %vec.base = shufflevector <4 x i64 addrspace(1)*> %vec1.base, <4 x i64 addrspace(1)*> %vec2.base, <2 x i32> <i32 0, i32 2>, !is_base_value !0
|
||||
; CHECK: %vec = shufflevector <4 x i64 addrspace(1)*> %vec1, <4 x i64 addrspace(1)*> %vec2, <2 x i32> <i32 0, i32 2>
|
||||
; CHECK: %bdv.base = extractelement <2 x i64 addrspace(1)*> %vec.base, i64 %idx, !is_base_value !0
|
||||
; CHECK: %bdv = extractelement <2 x i64 addrspace(1)*> %vec, i64 %idx
|
||||
; CHECK: gc.statepoint
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: (%bdv.base, %bdv)
|
||||
; CHECK-LABEL: @test8(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[GEP:%.*]] = getelementptr i64, i64 addrspace(1)* [[OBJ:%.*]], i64 1
|
||||
; CHECK-NEXT: [[GEP2:%.*]] = getelementptr i64, i64 addrspace(1)* [[OBJ]], i64 2
|
||||
; CHECK-NEXT: [[VEC1_BASE:%.*]] = insertelement <4 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[OBJ]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC1:%.*]] = insertelement <4 x i64 addrspace(1)*> undef, i64 addrspace(1)* [[GEP]], i32 0
|
||||
; CHECK-NEXT: [[VEC2_BASE:%.*]] = insertelement <4 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[OBJ]], i32 2, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC2:%.*]] = insertelement <4 x i64 addrspace(1)*> undef, i64 addrspace(1)* [[GEP2]], i32 2
|
||||
; CHECK-NEXT: [[VEC_BASE:%.*]] = shufflevector <4 x i64 addrspace(1)*> [[VEC1_BASE]], <4 x i64 addrspace(1)*> [[VEC2_BASE]], <2 x i32> <i32 0, i32 2>, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC:%.*]] = shufflevector <4 x i64 addrspace(1)*> [[VEC1]], <4 x i64 addrspace(1)*> [[VEC2]], <2 x i32> <i32 0, i32 2>
|
||||
; CHECK-NEXT: [[BDV_BASE:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC_BASE]], i64 [[IDX:%.*]], !is_base_value !0
|
||||
; CHECK-NEXT: [[BDV:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC]], i64 [[IDX]]
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(i64 addrspace(1)* [[BDV]], i64 addrspace(1)* [[BDV_BASE]]) ]
|
||||
; CHECK-NEXT: [[BDV_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[BDV_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[BDV_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[BDV_BASE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: call void @use(i64 addrspace(1)* [[BDV_RELOCATED_CASTED]])
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
entry:
|
||||
%gep = getelementptr i64, i64 addrspace(1)* %obj, i64 1
|
||||
%gep2 = getelementptr i64, i64 addrspace(1)* %obj, i64 2
|
||||
|
@ -198,15 +279,21 @@ entry:
|
|||
; Since the same 'base' vector is used in the shuffle operands, we do not need
|
||||
; create a shufflevector base.
|
||||
define void @test9(<4 x i64 addrspace(1)*> %vec1, i64 %idx) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test9
|
||||
; CHECK: %vec = shufflevector <4 x i64 addrspace(1)*> %vec1, <4 x i64 addrspace(1)*> %vec1, <2 x i32> <i32 0, i32 2>
|
||||
; CHECK: %base_ee = extractelement <4 x i64 addrspace(1)*> %vec1, i64 %idx, !is_base_value !0
|
||||
; CHECK: %bdv = extractelement <2 x i64 addrspace(1)*> %vec, i64 %idx
|
||||
; CHECK: gc.statepoint
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: (%base_ee, %bdv)
|
||||
; CHECK-LABEL: @test9(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[VEC:%.*]] = shufflevector <4 x i64 addrspace(1)*> [[VEC1:%.*]], <4 x i64 addrspace(1)*> [[VEC1]], <2 x i32> <i32 0, i32 2>
|
||||
; CHECK-NEXT: [[BASE_EE:%.*]] = extractelement <4 x i64 addrspace(1)*> [[VEC1]], i64 [[IDX:%.*]], !is_base_value !0
|
||||
; CHECK-NEXT: [[BDV:%.*]] = extractelement <2 x i64 addrspace(1)*> [[VEC]], i64 [[IDX]]
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(i64 addrspace(1)* [[BDV]], i64 addrspace(1)* [[BASE_EE]]) ]
|
||||
; CHECK-NEXT: [[BDV_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[BDV_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[BASE_EE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[BASE_EE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BASE_EE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: call void @use(i64 addrspace(1)* [[BDV_RELOCATED_CASTED]])
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
entry:
|
||||
; shrinking vec1 into vec
|
||||
; shrinking vec1 into vec
|
||||
%vec = shufflevector <4 x i64 addrspace(1)*> %vec1, <4 x i64 addrspace(1)*> %vec1, <2 x i32> <i32 0, i32 2>
|
||||
%bdv = extractelement <2 x i64 addrspace(1)*> %vec, i64 %idx
|
||||
call void @do_safepoint() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
||||
|
@ -216,7 +303,31 @@ entry:
|
|||
|
||||
; vector operand of shufflevector is a phi
|
||||
define i64 addrspace(1)* @test10(i1 %cnd, i64 addrspace(1)* %obj, i64 addrspace(1)* %obj2) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test10
|
||||
; CHECK-LABEL: @test10(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[VEC1_BASE:%.*]] = insertelement <4 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[OBJ:%.*]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC1:%.*]] = insertelement <4 x i64 addrspace(1)*> undef, i64 addrspace(1)* [[OBJ]], i32 0
|
||||
; CHECK-NEXT: br i1 [[CND:%.*]], label [[HERE:%.*]], label [[MERGE:%.*]]
|
||||
; CHECK: here:
|
||||
; CHECK-NEXT: [[VEC2_BASE:%.*]] = insertelement <4 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[OBJ2:%.*]], i32 2, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC2:%.*]] = insertelement <4 x i64 addrspace(1)*> undef, i64 addrspace(1)* [[OBJ2]], i32 2
|
||||
; CHECK-NEXT: br label [[MERGE]]
|
||||
; CHECK: merge:
|
||||
; CHECK-NEXT: [[VEC_BASE:%.*]] = phi <4 x i64 addrspace(1)*> [ [[VEC1_BASE]], [[ENTRY:%.*]] ], [ [[VEC2_BASE]], [[HERE]] ], [ [[VEC3_BASE:%.*]], [[MERGE]] ], !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC:%.*]] = phi <4 x i64 addrspace(1)*> [ [[VEC1]], [[ENTRY]] ], [ [[VEC2]], [[HERE]] ], [ [[VEC3:%.*]], [[MERGE]] ]
|
||||
; CHECK-NEXT: [[VEC3_BASE]] = shufflevector <4 x i64 addrspace(1)*> [[VEC_BASE]], <4 x i64 addrspace(1)*> [[VEC_BASE]], <4 x i32> <i32 2, i32 0, i32 1, i32 3>, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC3]] = shufflevector <4 x i64 addrspace(1)*> [[VEC]], <4 x i64 addrspace(1)*> [[VEC]], <4 x i32> <i32 2, i32 0, i32 1, i32 3>
|
||||
; CHECK-NEXT: [[BDV_BASE:%.*]] = extractelement <4 x i64 addrspace(1)*> [[VEC3_BASE]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[BDV:%.*]] = extractelement <4 x i64 addrspace(1)*> [[VEC3]], i32 0
|
||||
; CHECK-NEXT: br i1 [[CND]], label [[MERGE]], label [[NEXT:%.*]]
|
||||
; CHECK: next:
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(i64 addrspace(1)* [[BDV]], i64 addrspace(1)* [[BDV_BASE]]) ]
|
||||
; CHECK-NEXT: [[BDV_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[BDV_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: [[BDV_BASE_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[BDV_BASE_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[BDV_BASE_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: ret i64 addrspace(1)* [[BDV_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
%vec1 = insertelement <4 x i64 addrspace(1)*> undef, i64 addrspace(1)* %obj, i32 0
|
||||
br i1 %cnd, label %here, label %merge
|
||||
|
@ -226,23 +337,12 @@ here:
|
|||
br label %merge
|
||||
|
||||
merge: ; preds = %merge, %entry, %here
|
||||
; CHECK-LABEL: merge:
|
||||
; CHECK: %vec.base = phi <4 x i64 addrspace(1)*> [ %vec1.base, %entry ], [ %vec2.base, %here ], [ %vec3.base, %merge ], !is_base_value !0
|
||||
; CHECK: vec
|
||||
; CHECK: vec3.base = shufflevector <4 x i64 addrspace(1)*> %vec.base, <4 x i64 addrspace(1)*> %vec.base
|
||||
; CHECK: vec3
|
||||
; CHECK: bdv.base
|
||||
; CHECK: bdv
|
||||
%vec = phi <4 x i64 addrspace(1)*> [ %vec1, %entry ], [ %vec2, %here], [ %vec3, %merge]
|
||||
%vec3 = shufflevector <4 x i64 addrspace(1)*> %vec, <4 x i64 addrspace(1)*> %vec, <4 x i32> <i32 2, i32 0, i32 1, i32 3>
|
||||
%bdv = extractelement <4 x i64 addrspace(1)*> %vec3, i32 0
|
||||
br i1 %cnd, label %merge, label %next
|
||||
|
||||
next:
|
||||
; CHECK-LABEL: next:
|
||||
; CHECK: gc.statepoint
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-DAG: (%bdv.base, %bdv)
|
||||
call void @do_safepoint() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
||||
ret i64 addrspace(1)* %bdv
|
||||
}
|
||||
|
@ -250,11 +350,15 @@ declare void @do_safepoint()
|
|||
|
||||
define void @test11(<4 x i64 addrspace(1)*> %vec1) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test11(
|
||||
; CHECK: @llvm.experimental.gc.statepoint.p0f_isVoidf{{.*}}<4 x i64 addrspace(1)*> %vec1)
|
||||
; CHECK: %vec1.relocated = call coldcc <4 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v4p1i8
|
||||
; CHECK: %vec1.relocated.casted = bitcast <4 x i8 addrspace(1)*> %vec1.relocated to <4 x i64 addrspace(1)*>
|
||||
; CHECK: %vec2.remat = getelementptr i64, <4 x i64 addrspace(1)*> %vec1.relocated.casted, i32 1024
|
||||
; CHECK: call void @use_vec(<4 x i64 addrspace(1)*> %vec2.remat)
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[VEC2:%.*]] = getelementptr i64, <4 x i64 addrspace(1)*> [[VEC1:%.*]], i32 1024
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(<4 x i64 addrspace(1)*> [[VEC1]]) ]
|
||||
; CHECK-NEXT: [[VEC1_RELOCATED:%.*]] = call coldcc <4 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v4p1i8(token [[STATEPOINT_TOKEN]], i32 0, i32 0)
|
||||
; CHECK-NEXT: [[VEC1_RELOCATED_CASTED:%.*]] = bitcast <4 x i8 addrspace(1)*> [[VEC1_RELOCATED]] to <4 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: [[VEC2_REMAT:%.*]] = getelementptr i64, <4 x i64 addrspace(1)*> [[VEC1_RELOCATED_CASTED]], i32 1024
|
||||
; CHECK-NEXT: call void @use_vec(<4 x i64 addrspace(1)*> [[VEC2_REMAT]])
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
entry:
|
||||
%vec2 = getelementptr i64, <4 x i64 addrspace(1)*> %vec1, i32 1024
|
||||
call void @do_safepoint() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
||||
|
@ -266,11 +370,14 @@ declare <4 x i64 addrspace(1)*> @def_vec() "gc-leaf-function"
|
|||
|
||||
define void @test12(<4 x i64 addrspace(1)*> %vec1) gc "statepoint-example" {
|
||||
; CHECK-LABEL: @test12(
|
||||
; CHECK: @llvm.experimental.gc.statepoint.p0f_isVoidf{{.*}}<4 x i64 addrspace(1)*> %vec)
|
||||
; CHECK-NEXT: %vec.relocated = call coldcc <4 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v4p1i8(
|
||||
; CHECK-NEXT: %vec.relocated.casted = bitcast <4 x i8 addrspace(1)*> %vec.relocated to <4 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: call void @use_vec(<4 x i64 addrspace(1)*> %vec.relocated.casted)
|
||||
; CHECK-NEXT: ret void
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[VEC:%.*]] = call <4 x i64 addrspace(1)*> @def_vec()
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(<4 x i64 addrspace(1)*> [[VEC]]) ]
|
||||
; CHECK-NEXT: [[VEC_RELOCATED:%.*]] = call coldcc <4 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v4p1i8(token [[STATEPOINT_TOKEN]], i32 0, i32 0)
|
||||
; CHECK-NEXT: [[VEC_RELOCATED_CASTED:%.*]] = bitcast <4 x i8 addrspace(1)*> [[VEC_RELOCATED]] to <4 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: call void @use_vec(<4 x i64 addrspace(1)*> [[VEC_RELOCATED_CASTED]])
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
entry:
|
||||
%vec = call <4 x i64 addrspace(1)*> @def_vec()
|
||||
call void @do_safepoint() [ "deopt"() ]
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
; Test that we can correctly handle vectors of pointers in statepoint
|
||||
; rewriting.
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; Test that we can correctly handle vectors of pointers in statepoint
|
||||
; rewriting.
|
||||
; RUN: opt < %s -rewrite-statepoints-for-gc -S | FileCheck %s
|
||||
; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S | FileCheck %s
|
||||
|
||||
; A non-vector relocation for comparison
|
||||
define i64 addrspace(1)* @test(i64 addrspace(1)* %obj) gc "statepoint-example" {
|
||||
; CHECK-LABEL: test
|
||||
; CHECK: gc.statepoint
|
||||
; CHECK-NEXT: gc.relocate
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: ret i64 addrspace(1)*
|
||||
; CHECK-LABEL: @test(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(i64 addrspace(1)* [[OBJ:%.*]]) ]
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 0, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJ_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: ret i64 addrspace(1)* [[OBJ_RELOCATED_CASTED]]
|
||||
;
|
||||
; A base vector from a argument
|
||||
entry:
|
||||
call void @do_safepoint() [ "deopt"() ]
|
||||
|
@ -18,23 +21,26 @@ entry:
|
|||
|
||||
; A vector argument
|
||||
define <2 x i64 addrspace(1)*> @test2(<2 x i64 addrspace(1)*> %obj) gc "statepoint-example" {
|
||||
; CHECK-LABEL: test2
|
||||
; CHECK-NEXT: gc.statepoint
|
||||
; CHECK-NEXT: gc.relocate
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*>
|
||||
; CHECK-LABEL: @test2(
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(<2 x i64 addrspace(1)*> [[OBJ:%.*]]) ]
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc <2 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v2p1i8(token [[STATEPOINT_TOKEN]], i32 0, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED_CASTED:%.*]] = bitcast <2 x i8 addrspace(1)*> [[OBJ_RELOCATED]] to <2 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*> [[OBJ_RELOCATED_CASTED]]
|
||||
;
|
||||
call void @do_safepoint() [ "deopt"() ]
|
||||
ret <2 x i64 addrspace(1)*> %obj
|
||||
}
|
||||
|
||||
; A load
|
||||
define <2 x i64 addrspace(1)*> @test3(<2 x i64 addrspace(1)*>* %ptr) gc "statepoint-example" {
|
||||
; CHECK-LABEL: test3
|
||||
; CHECK: load
|
||||
; CHECK-NEXT: gc.statepoint
|
||||
; CHECK-NEXT: gc.relocate
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*>
|
||||
; CHECK-LABEL: @test3(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[OBJ:%.*]] = load <2 x i64 addrspace(1)*>, <2 x i64 addrspace(1)*>* [[PTR:%.*]], align 16
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(<2 x i64 addrspace(1)*> [[OBJ]]) ]
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc <2 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v2p1i8(token [[STATEPOINT_TOKEN]], i32 0, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED_CASTED:%.*]] = bitcast <2 x i8 addrspace(1)*> [[OBJ_RELOCATED]] to <2 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*> [[OBJ_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
%obj = load <2 x i64 addrspace(1)*>, <2 x i64 addrspace(1)*>* %ptr
|
||||
call void @do_safepoint() [ "deopt"() ]
|
||||
|
@ -45,42 +51,49 @@ declare i32 @fake_personality_function()
|
|||
|
||||
; When a statepoint is an invoke rather than a call
|
||||
define <2 x i64 addrspace(1)*> @test4(<2 x i64 addrspace(1)*>* %ptr) gc "statepoint-example" personality i32 ()* @fake_personality_function {
|
||||
; CHECK-LABEL: test4
|
||||
; CHECK: load
|
||||
; CHECK-NEXT: gc.statepoint
|
||||
; CHECK-LABEL: @test4(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[OBJ:%.*]] = load <2 x i64 addrspace(1)*>, <2 x i64 addrspace(1)*>* [[PTR:%.*]], align 16
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = invoke token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(<2 x i64 addrspace(1)*> [[OBJ]]) ]
|
||||
; CHECK-NEXT: to label [[NORMAL_RETURN:%.*]] unwind label [[EXCEPTIONAL_RETURN:%.*]]
|
||||
; CHECK: normal_return:
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED1:%.*]] = call coldcc <2 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v2p1i8(token [[STATEPOINT_TOKEN]], i32 0, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED1_CASTED:%.*]] = bitcast <2 x i8 addrspace(1)*> [[OBJ_RELOCATED1]] to <2 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*> [[OBJ_RELOCATED1_CASTED]]
|
||||
; CHECK: exceptional_return:
|
||||
; CHECK-NEXT: [[LANDING_PAD4:%.*]] = landingpad token
|
||||
; CHECK-NEXT: cleanup
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc <2 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v2p1i8(token [[LANDING_PAD4]], i32 0, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED_CASTED:%.*]] = bitcast <2 x i8 addrspace(1)*> [[OBJ_RELOCATED]] to <2 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*> [[OBJ_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
%obj = load <2 x i64 addrspace(1)*>, <2 x i64 addrspace(1)*>* %ptr
|
||||
invoke void @do_safepoint() [ "deopt"() ]
|
||||
to label %normal_return unwind label %exceptional_return
|
||||
to label %normal_return unwind label %exceptional_return
|
||||
|
||||
normal_return: ; preds = %entry
|
||||
; CHECK-LABEL: normal_return:
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*>
|
||||
ret <2 x i64 addrspace(1)*> %obj
|
||||
|
||||
exceptional_return: ; preds = %entry
|
||||
; CHECK-LABEL: exceptional_return:
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*>
|
||||
%landing_pad4 = landingpad token
|
||||
cleanup
|
||||
cleanup
|
||||
ret <2 x i64 addrspace(1)*> %obj
|
||||
}
|
||||
|
||||
; A newly created vector
|
||||
define <2 x i64 addrspace(1)*> @test5(i64 addrspace(1)* %p) gc "statepoint-example" {
|
||||
; CHECK-LABEL: test5
|
||||
; CHECK: insertelement
|
||||
; CHECK-NEXT: insertelement
|
||||
; CHECK-NEXT: gc.statepoint
|
||||
; CHECK-NEXT: gc.relocate
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: gc.relocate
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*> %vec.relocated.casted
|
||||
; CHECK-LABEL: @test5(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[VEC_BASE:%.*]] = insertelement <2 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[P:%.*]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC:%.*]] = insertelement <2 x i64 addrspace(1)*> poison, i64 addrspace(1)* [[P]], i32 0
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(<2 x i64 addrspace(1)*> [[VEC]], <2 x i64 addrspace(1)*> [[VEC_BASE]]) ]
|
||||
; CHECK-NEXT: [[VEC_RELOCATED:%.*]] = call coldcc <2 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v2p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[VEC_RELOCATED_CASTED:%.*]] = bitcast <2 x i8 addrspace(1)*> [[VEC_RELOCATED]] to <2 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: [[VEC_BASE_RELOCATED:%.*]] = call coldcc <2 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v2p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[VEC_BASE_RELOCATED_CASTED:%.*]] = bitcast <2 x i8 addrspace(1)*> [[VEC_BASE_RELOCATED]] to <2 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*> [[VEC_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
%vec = insertelement <2 x i64 addrspace(1)*> poison, i64 addrspace(1)* %p, i32 0
|
||||
call void @do_safepoint() [ "deopt"() ]
|
||||
|
@ -89,7 +102,25 @@ entry:
|
|||
|
||||
; A merge point
|
||||
define <2 x i64 addrspace(1)*> @test6(i1 %cnd, <2 x i64 addrspace(1)*>* %ptr) gc "statepoint-example" {
|
||||
; CHECK-LABEL: test6
|
||||
; CHECK-LABEL: @test6(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: br i1 [[CND:%.*]], label [[TAKEN:%.*]], label [[UNTAKEN:%.*]]
|
||||
; CHECK: taken:
|
||||
; CHECK-NEXT: [[OBJA:%.*]] = load <2 x i64 addrspace(1)*>, <2 x i64 addrspace(1)*>* [[PTR:%.*]], align 16
|
||||
; CHECK-NEXT: br label [[MERGE:%.*]]
|
||||
; CHECK: untaken:
|
||||
; CHECK-NEXT: [[OBJB:%.*]] = load <2 x i64 addrspace(1)*>, <2 x i64 addrspace(1)*>* [[PTR]], align 16
|
||||
; CHECK-NEXT: br label [[MERGE]]
|
||||
; CHECK: merge:
|
||||
; CHECK-NEXT: [[OBJ_BASE:%.*]] = phi <2 x i64 addrspace(1)*> [ [[OBJA]], [[TAKEN]] ], [ [[OBJB]], [[UNTAKEN]] ], !is_base_value !0
|
||||
; CHECK-NEXT: [[OBJ:%.*]] = phi <2 x i64 addrspace(1)*> [ [[OBJA]], [[TAKEN]] ], [ [[OBJB]], [[UNTAKEN]] ]
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(<2 x i64 addrspace(1)*> [[OBJ]], <2 x i64 addrspace(1)*> [[OBJ_BASE]]) ]
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc <2 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v2p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED_CASTED:%.*]] = bitcast <2 x i8 addrspace(1)*> [[OBJ_RELOCATED]] to <2 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: [[OBJ_BASE_RELOCATED:%.*]] = call coldcc <2 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v2p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[OBJ_BASE_RELOCATED_CASTED:%.*]] = bitcast <2 x i8 addrspace(1)*> [[OBJ_BASE_RELOCATED]] to <2 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*> [[OBJ_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
br i1 %cnd, label %taken, label %untaken
|
||||
|
||||
|
@ -102,15 +133,6 @@ untaken: ; preds = %entry
|
|||
br label %merge
|
||||
|
||||
merge: ; preds = %untaken, %taken
|
||||
; CHECK-LABEL: merge:
|
||||
; CHECK-NEXT: = phi
|
||||
; CHECK-NEXT: = phi
|
||||
; CHECK-NEXT: gc.statepoint
|
||||
; CHECK-NEXT: gc.relocate
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: gc.relocate
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*>
|
||||
%obj = phi <2 x i64 addrspace(1)*> [ %obja, %taken ], [ %objb, %untaken ]
|
||||
call void @do_safepoint() [ "deopt"() ]
|
||||
ret <2 x i64 addrspace(1)*> %obj
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
; Test that we can correctly handle vectors of pointers in statepoint
|
||||
; rewriting.
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; Test that we can correctly handle vectors of pointers in statepoint
|
||||
; rewriting.
|
||||
; RUN: opt < %s -rewrite-statepoints-for-gc -S | FileCheck %s
|
||||
; RUN: opt < %s -passes=rewrite-statepoints-for-gc -S | FileCheck %s
|
||||
|
||||
; A non-vector relocation for comparison
|
||||
define i64 addrspace(1)* @test(i64 addrspace(1)* %obj) gc "statepoint-example" {
|
||||
; CHECK-LABEL: test
|
||||
; CHECK: gc.statepoint
|
||||
; CHECK-NEXT: gc.relocate
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: ret i64 addrspace(1)*
|
||||
; CHECK-LABEL: @test(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(i64 addrspace(1)* [[OBJ:%.*]]) ]
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token [[STATEPOINT_TOKEN]], i32 0, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED_CASTED:%.*]] = bitcast i8 addrspace(1)* [[OBJ_RELOCATED]] to i64 addrspace(1)*
|
||||
; CHECK-NEXT: ret i64 addrspace(1)* [[OBJ_RELOCATED_CASTED]]
|
||||
;
|
||||
; A base vector from a argument
|
||||
entry:
|
||||
call void @do_safepoint() [ "deopt"() ]
|
||||
|
@ -18,23 +21,26 @@ entry:
|
|||
|
||||
; A vector argument
|
||||
define <2 x i64 addrspace(1)*> @test2(<2 x i64 addrspace(1)*> %obj) gc "statepoint-example" {
|
||||
; CHECK-LABEL: test2
|
||||
; CHECK-NEXT: gc.statepoint
|
||||
; CHECK-NEXT: gc.relocate
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*>
|
||||
; CHECK-LABEL: @test2(
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(<2 x i64 addrspace(1)*> [[OBJ:%.*]]) ]
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc <2 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v2p1i8(token [[STATEPOINT_TOKEN]], i32 0, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED_CASTED:%.*]] = bitcast <2 x i8 addrspace(1)*> [[OBJ_RELOCATED]] to <2 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*> [[OBJ_RELOCATED_CASTED]]
|
||||
;
|
||||
call void @do_safepoint() [ "deopt"() ]
|
||||
ret <2 x i64 addrspace(1)*> %obj
|
||||
}
|
||||
|
||||
; A load
|
||||
define <2 x i64 addrspace(1)*> @test3(<2 x i64 addrspace(1)*>* %ptr) gc "statepoint-example" {
|
||||
; CHECK-LABEL: test3
|
||||
; CHECK: load
|
||||
; CHECK-NEXT: gc.statepoint
|
||||
; CHECK-NEXT: gc.relocate
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*>
|
||||
; CHECK-LABEL: @test3(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[OBJ:%.*]] = load <2 x i64 addrspace(1)*>, <2 x i64 addrspace(1)*>* [[PTR:%.*]], align 16
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(<2 x i64 addrspace(1)*> [[OBJ]]) ]
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc <2 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v2p1i8(token [[STATEPOINT_TOKEN]], i32 0, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED_CASTED:%.*]] = bitcast <2 x i8 addrspace(1)*> [[OBJ_RELOCATED]] to <2 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*> [[OBJ_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
%obj = load <2 x i64 addrspace(1)*>, <2 x i64 addrspace(1)*>* %ptr
|
||||
call void @do_safepoint() [ "deopt"() ]
|
||||
|
@ -45,42 +51,49 @@ declare i32 @fake_personality_function()
|
|||
|
||||
; When a statepoint is an invoke rather than a call
|
||||
define <2 x i64 addrspace(1)*> @test4(<2 x i64 addrspace(1)*>* %ptr) gc "statepoint-example" personality i32 ()* @fake_personality_function {
|
||||
; CHECK-LABEL: test4
|
||||
; CHECK: load
|
||||
; CHECK-NEXT: gc.statepoint
|
||||
; CHECK-LABEL: @test4(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[OBJ:%.*]] = load <2 x i64 addrspace(1)*>, <2 x i64 addrspace(1)*>* [[PTR:%.*]], align 16
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = invoke token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(<2 x i64 addrspace(1)*> [[OBJ]]) ]
|
||||
; CHECK-NEXT: to label [[NORMAL_RETURN:%.*]] unwind label [[EXCEPTIONAL_RETURN:%.*]]
|
||||
; CHECK: normal_return:
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED1:%.*]] = call coldcc <2 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v2p1i8(token [[STATEPOINT_TOKEN]], i32 0, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED1_CASTED:%.*]] = bitcast <2 x i8 addrspace(1)*> [[OBJ_RELOCATED1]] to <2 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*> [[OBJ_RELOCATED1_CASTED]]
|
||||
; CHECK: exceptional_return:
|
||||
; CHECK-NEXT: [[LANDING_PAD4:%.*]] = landingpad token
|
||||
; CHECK-NEXT: cleanup
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc <2 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v2p1i8(token [[LANDING_PAD4]], i32 0, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED_CASTED:%.*]] = bitcast <2 x i8 addrspace(1)*> [[OBJ_RELOCATED]] to <2 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*> [[OBJ_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
%obj = load <2 x i64 addrspace(1)*>, <2 x i64 addrspace(1)*>* %ptr
|
||||
invoke void @do_safepoint() [ "deopt"() ]
|
||||
to label %normal_return unwind label %exceptional_return
|
||||
to label %normal_return unwind label %exceptional_return
|
||||
|
||||
normal_return: ; preds = %entry
|
||||
; CHECK-LABEL: normal_return:
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*>
|
||||
ret <2 x i64 addrspace(1)*> %obj
|
||||
|
||||
exceptional_return: ; preds = %entry
|
||||
; CHECK-LABEL: exceptional_return:
|
||||
; CHECK: gc.relocate
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*>
|
||||
%landing_pad4 = landingpad token
|
||||
cleanup
|
||||
cleanup
|
||||
ret <2 x i64 addrspace(1)*> %obj
|
||||
}
|
||||
|
||||
; A newly created vector
|
||||
define <2 x i64 addrspace(1)*> @test5(i64 addrspace(1)* %p) gc "statepoint-example" {
|
||||
; CHECK-LABEL: test5
|
||||
; CHECK: insertelement
|
||||
; CHECK-NEXT: insertelement
|
||||
; CHECK-NEXT: gc.statepoint
|
||||
; CHECK-NEXT: gc.relocate
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: gc.relocate
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*> %vec.relocated.casted
|
||||
; CHECK-LABEL: @test5(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[VEC_BASE:%.*]] = insertelement <2 x i64 addrspace(1)*> zeroinitializer, i64 addrspace(1)* [[P:%.*]], i32 0, !is_base_value !0
|
||||
; CHECK-NEXT: [[VEC:%.*]] = insertelement <2 x i64 addrspace(1)*> undef, i64 addrspace(1)* [[P]], i32 0
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(<2 x i64 addrspace(1)*> [[VEC]], <2 x i64 addrspace(1)*> [[VEC_BASE]]) ]
|
||||
; CHECK-NEXT: [[VEC_RELOCATED:%.*]] = call coldcc <2 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v2p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[VEC_RELOCATED_CASTED:%.*]] = bitcast <2 x i8 addrspace(1)*> [[VEC_RELOCATED]] to <2 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: [[VEC_BASE_RELOCATED:%.*]] = call coldcc <2 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v2p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[VEC_BASE_RELOCATED_CASTED:%.*]] = bitcast <2 x i8 addrspace(1)*> [[VEC_BASE_RELOCATED]] to <2 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*> [[VEC_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
%vec = insertelement <2 x i64 addrspace(1)*> undef, i64 addrspace(1)* %p, i32 0
|
||||
call void @do_safepoint() [ "deopt"() ]
|
||||
|
@ -89,7 +102,25 @@ entry:
|
|||
|
||||
; A merge point
|
||||
define <2 x i64 addrspace(1)*> @test6(i1 %cnd, <2 x i64 addrspace(1)*>* %ptr) gc "statepoint-example" {
|
||||
; CHECK-LABEL: test6
|
||||
; CHECK-LABEL: @test6(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: br i1 [[CND:%.*]], label [[TAKEN:%.*]], label [[UNTAKEN:%.*]]
|
||||
; CHECK: taken:
|
||||
; CHECK-NEXT: [[OBJA:%.*]] = load <2 x i64 addrspace(1)*>, <2 x i64 addrspace(1)*>* [[PTR:%.*]], align 16
|
||||
; CHECK-NEXT: br label [[MERGE:%.*]]
|
||||
; CHECK: untaken:
|
||||
; CHECK-NEXT: [[OBJB:%.*]] = load <2 x i64 addrspace(1)*>, <2 x i64 addrspace(1)*>* [[PTR]], align 16
|
||||
; CHECK-NEXT: br label [[MERGE]]
|
||||
; CHECK: merge:
|
||||
; CHECK-NEXT: [[OBJ_BASE:%.*]] = phi <2 x i64 addrspace(1)*> [ [[OBJA]], [[TAKEN]] ], [ [[OBJB]], [[UNTAKEN]] ], !is_base_value !0
|
||||
; CHECK-NEXT: [[OBJ:%.*]] = phi <2 x i64 addrspace(1)*> [ [[OBJA]], [[TAKEN]] ], [ [[OBJB]], [[UNTAKEN]] ]
|
||||
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(), "gc-live"(<2 x i64 addrspace(1)*> [[OBJ]], <2 x i64 addrspace(1)*> [[OBJ_BASE]]) ]
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc <2 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v2p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 0)
|
||||
; CHECK-NEXT: [[OBJ_RELOCATED_CASTED:%.*]] = bitcast <2 x i8 addrspace(1)*> [[OBJ_RELOCATED]] to <2 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: [[OBJ_BASE_RELOCATED:%.*]] = call coldcc <2 x i8 addrspace(1)*> @llvm.experimental.gc.relocate.v2p1i8(token [[STATEPOINT_TOKEN]], i32 1, i32 1)
|
||||
; CHECK-NEXT: [[OBJ_BASE_RELOCATED_CASTED:%.*]] = bitcast <2 x i8 addrspace(1)*> [[OBJ_BASE_RELOCATED]] to <2 x i64 addrspace(1)*>
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*> [[OBJ_RELOCATED_CASTED]]
|
||||
;
|
||||
entry:
|
||||
br i1 %cnd, label %taken, label %untaken
|
||||
|
||||
|
@ -102,15 +133,6 @@ untaken: ; preds = %entry
|
|||
br label %merge
|
||||
|
||||
merge: ; preds = %untaken, %taken
|
||||
; CHECK-LABEL: merge:
|
||||
; CHECK-NEXT: = phi
|
||||
; CHECK-NEXT: = phi
|
||||
; CHECK-NEXT: gc.statepoint
|
||||
; CHECK-NEXT: gc.relocate
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: gc.relocate
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: ret <2 x i64 addrspace(1)*>
|
||||
%obj = phi <2 x i64 addrspace(1)*> [ %obja, %taken ], [ %objb, %untaken ]
|
||||
call void @do_safepoint() [ "deopt"() ]
|
||||
ret <2 x i64 addrspace(1)*> %obj
|
||||
|
|
Loading…
Reference in New Issue