1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -S -passes='loop-mssa(licm,loop-simplifycfg)' < %s | FileCheck %s 3 4; Here we end un sinking a user of token down from the loop, therefore breaching LCSSA form. 5; Then, LoopSimplifyCFG expcets that LCSSA form is maintained, and remains unaware that 6; it may be penetrated by tokens. As result, it may end up breaking dominance between def and 7; use by introducing fake temporary edges. 8 9define ptr addrspace(1) @test_gc_relocate() gc "statepoint-example" { 10; CHECK-LABEL: @test_gc_relocate( 11; CHECK-NEXT: br label [[BB1:%.*]] 12; CHECK: bb1: 13; CHECK-NEXT: switch i32 undef, label [[BB43:%.*]] [ 14; CHECK-NEXT: i32 1, label [[BB18:%.*]] 15; CHECK-NEXT: ] 16; CHECK: bb18: 17; CHECK-NEXT: switch i32 undef, label [[BB43]] [ 18; CHECK-NEXT: i32 0, label [[BB28:%.*]] 19; CHECK-NEXT: ] 20; CHECK: bb28: 21; CHECK-NEXT: [[TMP34:%.*]] = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2882400000, i32 0, ptr nonnull elementtype(ptr addrspace(1) (i64, i32, i32, i32)) @barney.4, i32 4, i32 0, i64 undef, i32 5, i32 5, i32 undef, i32 0, i32 0) [ "deopt"(), "gc-live"(ptr addrspace(1) undef) ] 22; CHECK-NEXT: br i1 false, label [[BB57:%.*]], label [[BB36:%.*]] 23; CHECK: bb36: 24; CHECK-NEXT: switch i32 undef, label [[BB43]] [ 25; CHECK-NEXT: i32 1, label [[BB39:%.*]] 26; CHECK-NEXT: ] 27; CHECK: bb39: 28; CHECK-NEXT: switch i32 undef, label [[BB43]] [ 29; CHECK-NEXT: i32 1, label [[BB45:%.*]] 30; CHECK-NEXT: ] 31; CHECK: bb43: 32; CHECK-NEXT: unreachable 33; CHECK: bb45: 34; CHECK-NEXT: br label [[BB1]] 35; CHECK: bb57: 36; CHECK-NEXT: [[TMP35_LE:%.*]] = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token [[TMP34]], i32 0, i32 0) 37; CHECK-NEXT: ret ptr addrspace(1) [[TMP35_LE]] 38; 39 br label %bb1 40 41bb1: ; preds = %bb45, %0 42 switch i32 undef, label %bb43 [ 43 i32 1, label %bb18 44 ] 45 46bb18: ; preds = %bb1 47 switch i32 undef, label %bb43 [ 48 i32 0, label %bb28 49 ] 50 51bb28: ; preds = %bb18 52 %tmp34 = call token (i64, i32, ptr addrspace(1) (i64, i32, i32, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2882400000, i32 0, ptr addrspace(1) (i64, i32, i32, i32)* nonnull elementtype(ptr addrspace(1) (i64, i32, i32, i32)) @barney.4, i32 4, i32 0, i64 undef, i32 5, i32 5, i32 undef, i32 0, i32 0) [ "deopt"(), "gc-live"(ptr addrspace(1) undef) ] 53 %tmp35 = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %tmp34, i32 0, i32 0) ; (undef, undef) 54 br i1 false, label %bb57, label %bb36 55 56bb36: ; preds = %bb28 57 switch i32 undef, label %bb43 [ 58 i32 1, label %bb39 59 ] 60 61bb39: ; preds = %bb36 62 switch i32 undef, label %bb43 [ 63 i32 1, label %bb45 64 ] 65 66bb43: ; preds = %bb39, %bb36, %bb18, %bb1 67 unreachable 68 69bb45: ; preds = %bb39 70 br label %bb1 71 72bb57: ; preds = %bb28 73 ret ptr addrspace(1) %tmp35 74} 75 76declare ptr addrspace(1) @barney.4(i64, i32, i32, i32) 77 78declare ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token, i32 immarg, i32 immarg) #0 79 80declare token @llvm.experimental.gc.statepoint.p0(i64 immarg, i32 immarg, ptr addrspace(1) (i64, i32, i32, i32)*, i32 immarg, i32 immarg, ...) 81 82attributes #0 = { nounwind readnone } 83