• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test that patterns of transformations which disconnect a region of the call
2; graph mid-traversal and then invalidate it function correctly.
3;
4; RUN: opt -S -passes='cgscc(inline,function(simplify-cfg))' < %s | FileCheck %s
5
6define internal void @test_scc_internal(i1 %flag) {
7; CHECK-NOT: @test_scc_internal
8entry:
9  br i1 %flag, label %then, label %else
10
11then:
12  call void @test_scc_internal(i1 false)
13  call void @test_scc_external()
14  br label %else
15
16else:
17  ret void
18}
19
20define void @test_scc_external() {
21; CHECK-LABEL: define void @test_scc_external()
22entry:
23  call void @test_scc_internal(i1 false)
24  ret void
25}
26
27define internal void @test_refscc_internal(i1 %flag, i8* %ptr) {
28; CHECK-NOT: @test_refscc_internal
29entry:
30  br i1 %flag, label %then, label %else
31
32then:
33  call void @test_refscc_internal(i1 false, i8* bitcast (i8* ()* @test_refscc_external to i8*))
34  br label %else
35
36else:
37  ret void
38}
39
40define i8* @test_refscc_external() {
41; CHECK-LABEL: define i8* @test_refscc_external()
42entry:
43  br i1 true, label %then, label %else
44; CHECK-NEXT:  entry:
45; CHECK-NEXT:    ret i8* null
46; CHECK-NEXT:  }
47; CHECK-NOT: @test_refscc_internal
48
49then:
50  ret i8* null
51
52else:
53  ret i8* bitcast (void (i1, i8*)* @test_refscc_internal to i8*)
54}
55