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
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.
9 define ptr addrspace(1) @test_gc_relocate() gc "statepoint-example" {
10 ; CHECK-LABEL: @test_gc_relocate(
11 ; CHECK-NEXT: br label [[BB1:%.*]]
13 ; CHECK-NEXT: switch i32 undef, label [[BB43:%.*]] [
14 ; CHECK-NEXT: i32 1, label [[BB18:%.*]]
17 ; CHECK-NEXT: switch i32 undef, label [[BB43]] [
18 ; CHECK-NEXT: i32 0, label [[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:%.*]]
24 ; CHECK-NEXT: switch i32 undef, label [[BB43]] [
25 ; CHECK-NEXT: i32 1, label [[BB39:%.*]]
28 ; CHECK-NEXT: switch i32 undef, label [[BB43]] [
29 ; CHECK-NEXT: i32 1, label [[BB45:%.*]]
32 ; CHECK-NEXT: unreachable
34 ; CHECK-NEXT: br label [[BB1]]
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]]
41 bb1: ; preds = %bb45, %0
42 switch i32 undef, label %bb43 [
47 switch i32 undef, label %bb43 [
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
57 switch i32 undef, label %bb43 [
62 switch i32 undef, label %bb43 [
66 bb43: ; preds = %bb39, %bb36, %bb18, %bb1
73 ret ptr addrspace(1) %tmp35
76 declare ptr addrspace(1) @barney.4(i64, i32, i32, i32)
78 declare ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token, i32 immarg, i32 immarg) #0
80 declare token @llvm.experimental.gc.statepoint.p0(i64 immarg, i32 immarg, ptr addrspace(1) (i64, i32, i32, i32)*, i32 immarg, i32 immarg, ...)
82 attributes #0 = { nounwind readnone }