; CHECK-NEXT: [[OBJ:%.*]] = call ptr addrspace(1) @generate_obj()
; CHECK-NEXT: br label [[LOOP:%.*]]
; CHECK: loop:
-; CHECK-NEXT: [[DOT0:%.*]] = phi ptr addrspace(1) [ [[OBJ]], [[ENTRY:%.*]] ], [ [[OBJ_RELOCATED_CASTED:%.*]], [[LOOP]] ]
+; CHECK-NEXT: [[DOT0:%.*]] = phi ptr addrspace(1) [ [[OBJ]], [[ENTRY:%.*]] ], [ [[OBJ_RELOCATED:%.*]], [[LOOP]] ]
; CHECK-NEXT: call void @use_obj(ptr addrspace(1) [[DOT0]])
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2882400000, i32 0, ptr elementtype(void ()) @do_safepoint, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(ptr addrspace(1) [[DOT0]]) ]
-; CHECK-NEXT: [[OBJ_RELOCATED:%.*]] = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token [[STATEPOINT_TOKEN]], i32 0, i32 0)
+; CHECK-NEXT: [[OBJ_RELOCATED]] = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token [[STATEPOINT_TOKEN]], i32 0, i32 0)
; CHECK-NEXT: br label [[LOOP]]
;
entry:
declare void @parse_point(ptr addrspace(1))
-define ptr addrspace(1) @test1(i32 %caller, ptr addrspace(1) %a, ptr addrspace(1) %b, i32 %unknown) gc "statepoint-example" {
+define ptr addrspace(1) @test1(i32 %caller, ptr addrspace(1) %a, ptr addrspace(1) %b, i32 %unknown, i1 %c) gc "statepoint-example" {
; CHECK-LABEL: @test1(
; CHECK-NEXT: entry:
-; CHECK-NEXT: br i1 undef, label [[LEFT:%.*]], label [[RIGHT:%.*]]
+; CHECK-NEXT: br i1 [[C:%.*]], label [[LEFT:%.*]], label [[RIGHT:%.*]]
; CHECK: left:
; CHECK-NEXT: switch i32 [[UNKNOWN:%.*]], label [[RIGHT]] [
; CHECK-NEXT: i32 0, label [[MERGE:%.*]]
; CHECK-NEXT: ret ptr addrspace(1) [[VALUE_RELOCATED]]
;
entry:
- br i1 undef, label %left, label %right
+ br i1 %c, label %left, label %right
left:
; Our safepoint placement pass calls removeUnreachableBlocks, which does a bunch
; CHECK-NEXT: [[OBJ:%.*]] = getelementptr i64, ptr addrspace(1) [[BASE_OBJ:%.*]], i32 1
; CHECK-NEXT: br label [[LOOP:%.*]]
; CHECK: loop:
-; CHECK-NEXT: [[DOT0:%.*]] = phi ptr addrspace(1) [ [[BASE_ARG2:%.*]], [[ENTRY:%.*]] ], [ [[BASE_ARG2_RELOCATED_CASTED:%.*]], [[LOOP]] ]
-; CHECK-NEXT: [[CURRENT_BASE:%.*]] = phi ptr addrspace(1) [ [[BASE_OBJ]], [[ENTRY]] ], [ [[NEXT_BASE_RELOCATED_CASTED:%.*]], [[LOOP]] ], !is_base_value !0
-; CHECK-NEXT: [[CURRENT:%.*]] = phi ptr addrspace(1) [ [[OBJ]], [[ENTRY]] ], [ [[NEXT_RELOCATED_CASTED:%.*]], [[LOOP]] ]
-; CHECK-NEXT: [[EXTRA:%.*]] = phi ptr addrspace(1) [ [[OBJ]], [[ENTRY]] ], [ [[EXTRA2_RELOCATED_CASTED:%.*]], [[LOOP]] ]
+; CHECK-NEXT: [[DOT0:%.*]] = phi ptr addrspace(1) [ [[BASE_ARG2:%.*]], [[ENTRY:%.*]] ], [ [[BASE_ARG2_RELOCATED:%.*]], [[LOOP]] ]
+; CHECK-NEXT: [[CURRENT_BASE:%.*]] = phi ptr addrspace(1) [ [[BASE_OBJ]], [[ENTRY]] ], [ [[NEXT_BASE_RELOCATED:%.*]], [[LOOP]] ], !is_base_value !0
+; CHECK-NEXT: [[CURRENT:%.*]] = phi ptr addrspace(1) [ [[OBJ]], [[ENTRY]] ], [ [[NEXT_RELOCATED:%.*]], [[LOOP]] ]
+; CHECK-NEXT: [[EXTRA:%.*]] = phi ptr addrspace(1) [ [[OBJ]], [[ENTRY]] ], [ [[EXTRA2_RELOCATED:%.*]], [[LOOP]] ]
; CHECK-NEXT: [[NEXTA:%.*]] = getelementptr i64, ptr addrspace(1) [[CURRENT]], i32 1
; CHECK-NEXT: [[NEXT_BASE:%.*]] = select i1 [[CND:%.*]], ptr addrspace(1) [[CURRENT_BASE]], ptr addrspace(1) [[DOT0]], !is_base_value !0
; CHECK-NEXT: [[NEXT:%.*]] = select i1 [[CND]], ptr addrspace(1) [[NEXTA]], ptr addrspace(1) [[DOT0]]
; CHECK-NEXT: [[EXTRA2_BASE:%.*]] = select i1 [[CND]], ptr addrspace(1) [[CURRENT_BASE]], ptr addrspace(1) [[DOT0]], !is_base_value !0
; CHECK-NEXT: [[EXTRA2:%.*]] = select i1 [[CND]], ptr addrspace(1) [[NEXTA]], ptr addrspace(1) [[DOT0]]
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2882400000, i32 0, ptr elementtype(void ()) @foo, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0), "gc-live"(ptr addrspace(1) [[NEXT_BASE]], ptr addrspace(1) [[NEXT]], ptr addrspace(1) [[EXTRA2]], ptr addrspace(1) [[DOT0]], ptr addrspace(1) [[EXTRA2_BASE]]) ]
-; CHECK-NEXT: [[NEXT_BASE_RELOCATED:%.*]] = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token [[STATEPOINT_TOKEN]], i32 0, i32 0)
-; CHECK-NEXT: [[NEXT_RELOCATED:%.*]] = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token [[STATEPOINT_TOKEN]], i32 0, i32 1)
-; CHECK-NEXT: [[EXTRA2_RELOCATED:%.*]] = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token [[STATEPOINT_TOKEN]], i32 4, i32 2)
-; CHECK-NEXT: [[BASE_ARG2_RELOCATED:%.*]] = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token [[STATEPOINT_TOKEN]], i32 3, i32 3)
+; CHECK-NEXT: [[NEXT_BASE_RELOCATED]] = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token [[STATEPOINT_TOKEN]], i32 0, i32 0)
+; CHECK-NEXT: [[NEXT_RELOCATED]] = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token [[STATEPOINT_TOKEN]], i32 0, i32 1)
+; CHECK-NEXT: [[EXTRA2_RELOCATED]] = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token [[STATEPOINT_TOKEN]], i32 4, i32 2)
+; CHECK-NEXT: [[BASE_ARG2_RELOCATED]] = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token [[STATEPOINT_TOKEN]], i32 3, i32 3)
; CHECK-NEXT: [[EXTRA2_BASE_RELOCATED:%.*]] = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token [[STATEPOINT_TOKEN]], i32 4, i32 4)
; CHECK-NEXT: br label [[LOOP]]
;
; but contains the range metadata.
; Since loadedval is not marked invariant, it will prevent incorrectly sinking
; %loadedval in LICM and avoid creation of an unrelocated use of %baseaddr.
-define void @test_invariant_load() gc "statepoint-example" {
+define void @test_invariant_load(i1 %c) gc "statepoint-example" {
; CHECK-LABEL: @test_invariant_load
; CHECK: %loadedval = load i32, ptr addrspace(1) %baseaddr, align 8, !range !0
bb:
br label %innermostloophdr
innermostloophdr: ; preds = %bb6, %innerloopHdr
- br i1 undef, label %exitblock, label %bb6
+ br i1 %c, label %exitblock, label %bb6
bb6: ; preds = %innermostloophdr
switch i32 undef, label %innermostloophdr [
}
; Check to make sure we handle values live over an entry statepoint
-define void @test6(i8 addrspace(1)* %arg1, i8 addrspace(1)* %arg2, i8 addrspace(1)* %arg3) gc "statepoint-example" {
+define void @test6(i8 addrspace(1)* %arg1, i8 addrspace(1)* %arg2, i8 addrspace(1)* %arg3, i1 %c) gc "statepoint-example" {
; CHECK-LABEL: @test6
entry:
- br i1 undef, label %gc.safepoint_poll.exit2, label %do_safepoint
+ br i1 %c, label %gc.safepoint_poll.exit2, label %do_safepoint
do_safepoint: ; preds = %entry
; CHECK-LABEL: do_safepoint:
; Uses of extractelement that are of scalar type should not have the BDV
; incorrectly identified as a vector type.
-define void @widget() gc "statepoint-example" {
+define void @widget(i1 %c) gc "statepoint-example" {
; CHECK-LABEL: @widget(
; CHECK-NEXT: bb6:
; CHECK-NEXT: [[BASE_EE:%.*]] = extractelement <2 x ptr addrspace(1)> zeroinitializer, i32 1, !is_base_value !0
; CHECK-NEXT: [[TMP:%.*]] = extractelement <2 x ptr addrspace(1)> undef, i32 1
-; CHECK-NEXT: br i1 undef, label [[BB7:%.*]], label [[BB9:%.*]]
+; CHECK-NEXT: br i1 [[C:%.*]], label [[BB7:%.*]], label [[BB9:%.*]]
; CHECK: bb7:
; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr addrspace(1) [[TMP]], i64 12
; CHECK-NEXT: br label [[BB11:%.*]]
; CHECK: bb9:
; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, ptr addrspace(1) [[TMP]], i64 12
-; CHECK-NEXT: br i1 undef, label [[BB11]], label [[BB15:%.*]]
+; CHECK-NEXT: br i1 [[C]], label [[BB11]], label [[BB15:%.*]]
; CHECK: bb11:
; CHECK-NEXT: [[TMP12_BASE:%.*]] = phi ptr addrspace(1) [ [[BASE_EE]], [[BB7]] ], [ [[BASE_EE]], [[BB9]] ], !is_base_value !0
; CHECK-NEXT: [[TMP12:%.*]] = phi ptr addrspace(1) [ [[TMP8]], [[BB7]] ], [ [[TMP10]], [[BB9]] ]
; CHECK: bb15:
; CHECK-NEXT: [[TMP16_BASE:%.*]] = phi ptr addrspace(1) [ [[BASE_EE]], [[BB9]] ], [ [[TMP12_BASE_RELOCATED]], [[BB11]] ], !is_base_value !0
; CHECK-NEXT: [[TMP16:%.*]] = phi ptr addrspace(1) [ [[TMP10]], [[BB9]] ], [ [[TMP12_RELOCATED]], [[BB11]] ]
-; CHECK-NEXT: br i1 undef, label [[BB17:%.*]], label [[BB20:%.*]]
+; CHECK-NEXT: br i1 [[C]], label [[BB17:%.*]], label [[BB20:%.*]]
; CHECK: bb17:
; CHECK-NEXT: [[STATEPOINT_TOKEN1:%.*]] = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2882400000, i32 0, ptr elementtype(void ()) @snork, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 undef), "gc-live"(ptr addrspace(1) [[TMP16_BASE]], ptr addrspace(1) [[TMP16]]) ]
; CHECK-NEXT: [[TMP16_BASE_RELOCATED:%.*]] = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token [[STATEPOINT_TOKEN1]], i32 0, i32 0)
;
bb6: ; preds = %bb3
%tmp = extractelement <2 x ptr addrspace(1)> undef, i32 1
- br i1 undef, label %bb7, label %bb9
+ br i1 %c, label %bb7, label %bb9
bb7: ; preds = %bb6
%tmp8 = getelementptr inbounds i8, ptr addrspace(1) %tmp, i64 12
bb9: ; preds = %bb6, %bb6
%tmp10 = getelementptr inbounds i8, ptr addrspace(1) %tmp, i64 12
- br i1 undef, label %bb11, label %bb15
+ br i1 %c, label %bb11, label %bb15
bb11: ; preds = %bb9, %bb7
%tmp12 = phi ptr addrspace(1) [ %tmp8, %bb7 ], [ %tmp10, %bb9 ]
bb15: ; preds = %bb11, %bb9, %bb9
%tmp16 = phi ptr addrspace(1) [ %tmp10, %bb9 ], [ %tmp12, %bb11 ]
- br i1 undef, label %bb17, label %bb20
+ br i1 %c, label %bb17, label %bb20
bb17: ; preds = %bb15
call void @snork() [ "deopt"(i32 undef) ]
declare void @do_safepoint()
declare ptr addrspace(1) @def_ptr()
-define ptr addrspace(1) @test1(ptr addrspace(1) %base1, <2 x i64> %offsets) gc "statepoint-example" {
+define ptr addrspace(1) @test1(ptr addrspace(1) %base1, <2 x i64> %offsets, i1 %c) gc "statepoint-example" {
; CHECK-LABEL: @test1(
; CHECK-NEXT: entry:
-; CHECK-NEXT: br i1 undef, label [[FIRST:%.*]], label [[SECOND:%.*]]
+; CHECK-NEXT: br i1 [[C:%.*]], label [[FIRST:%.*]], label [[SECOND:%.*]]
; CHECK: first:
; CHECK-NEXT: [[STATEPOINT_TOKEN:%.*]] = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2882400000, i32 0, ptr elementtype(ptr addrspace(1) ()) @def_ptr, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
; CHECK-NEXT: [[BASE21:%.*]] = call ptr addrspace(1) @llvm.experimental.gc.result.p1(token [[STATEPOINT_TOKEN]])
; CHECK-NEXT: ret ptr addrspace(1) [[PTR_RELOCATED]]
;
entry:
- br i1 undef, label %first, label %second
+ br i1 %c, label %first, label %second
first:
%base2 = call ptr addrspace(1) @def_ptr() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
ret ptr addrspace(1) %ptr
}
-define void @test6() gc "statepoint-example" {
+define void @test6(i1 %c) gc "statepoint-example" {
; CHECK-LABEL: @test6(
; CHECK-NEXT: bb:
; CHECK-NEXT: br label [[HEADER:%.*]]
; CHECK-NEXT: [[STATEPOINT_TOKEN1:%.*]] = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2882400000, i32 0, ptr elementtype(<2 x ptr addrspace(1)> ()) @baz, i32 0, i32 0, i32 0, i32 0)
; CHECK-NEXT: [[TMP262:%.*]] = call <2 x ptr addrspace(1)> @llvm.experimental.gc.result.v2p1(token [[STATEPOINT_TOKEN1]])
; CHECK-NEXT: [[TMP27:%.*]] = extractelement <2 x ptr addrspace(1)> [[TMP262]], i32 0
-; CHECK-NEXT: br i1 undef, label [[BB7:%.*]], label [[LATCH]]
+; CHECK-NEXT: br i1 [[C:%.*]], label [[BB7:%.*]], label [[LATCH]]
; CHECK: bb7:
; CHECK-NEXT: br label [[LATCH]]
; CHECK: latch:
bb25: ; preds = %bb24
%tmp26 = call <2 x ptr addrspace(1)> @baz()
%tmp27 = extractelement <2 x ptr addrspace(1)> %tmp26, i32 0
- br i1 undef, label %bb7, label %latch
+ br i1 %c, label %bb7, label %latch
bb7: ; preds = %bb25
br label %latch