1; RUN: opt -S -passes='loop-mssa(licm,loop-simplifycfg)' < %s | FileCheck %s
2
3; REQUIRES: asserts
4; XFAIL: *
5
6; Here we end un sinking a user of token down from the loop, therefore breaching LCSSA form.
7; Then, LoopSimplifyCFG expcets that LCSSA form is maintained, and remains unaware that
8; it may be penetrated by tokens. As result, it may end up breaking dominance between def and
9; use by introducing fake temporary edges.
10
11define i8 addrspace(1)* @test_gc_relocate() gc "statepoint-example" {
12; CHECK-LABEL: @test_gc_relocate
13  br label %bb1
14
15bb1:                                              ; preds = %bb45, %0
16  switch i32 undef, label %bb43 [
17    i32 1, label %bb18
18  ]
19
20bb18:                                             ; preds = %bb1
21  switch i32 undef, label %bb43 [
22    i32 0, label %bb28
23  ]
24
25bb28:                                             ; preds = %bb18
26  %tmp34 = call token (i64, i32, i8 addrspace(1)* (i64, i32, i32, i32)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_p1i8i64i32i32i32f(i64 2882400000, i32 0, i8 addrspace(1)* (i64, i32, i32, i32)* nonnull elementtype(i8 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"(i8 addrspace(1)* undef) ]
27  %tmp35 = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %tmp34, i32 0, i32 0) ; (undef, undef)
28  br i1 false, label %bb57, label %bb36
29
30bb36:                                             ; preds = %bb28
31  switch i32 undef, label %bb43 [
32    i32 1, label %bb39
33  ]
34
35bb39:                                             ; preds = %bb36
36  switch i32 undef, label %bb43 [
37    i32 1, label %bb45
38  ]
39
40bb43:                                             ; preds = %bb39, %bb36, %bb18, %bb1
41  unreachable
42
43bb45:                                             ; preds = %bb39
44  br label %bb1
45
46bb57:                                             ; preds = %bb28
47  ret i8 addrspace(1)* %tmp35
48}
49
50declare i8 addrspace(1)* @barney.4(i64, i32, i32, i32)
51
52declare i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token, i32 immarg, i32 immarg) #0
53
54declare token @llvm.experimental.gc.statepoint.p0f_p1i8i64i32i32i32f(i64 immarg, i32 immarg, i8 addrspace(1)* (i64, i32, i32, i32)*, i32 immarg, i32 immarg, ...)
55
56attributes #0 = { nounwind readnone }
57