1 ; Test that patterns of transformations which disconnect a region of the call
2 ; graph mid-traversal and then invalidate it function correctly.
4 ; RUN: opt -S -passes='cgscc(inline,function(simplify-cfg))' < %s | FileCheck %s
6 define internal void @test_scc_internal(i1 %flag) {
7 ; CHECK-NOT: @test_scc_internal
9 br i1 %flag, label %then, label %else
12 call void @test_scc_internal(i1 false)
13 call void @test_scc_external()
20 define void @test_scc_external() {
21 ; CHECK-LABEL: define void @test_scc_external()
23 call void @test_scc_internal(i1 false)
27 define internal void @test_refscc_internal(i1 %flag, i8* %ptr) {
28 ; CHECK-NOT: @test_refscc_internal
30 br i1 %flag, label %then, label %else
33 call void @test_refscc_internal(i1 false, i8* bitcast (i8* ()* @test_refscc_external to i8*))
40 define i8* @test_refscc_external() {
41 ; CHECK-LABEL: define i8* @test_refscc_external()
43 br i1 true, label %then, label %else
45 ; CHECK-NEXT: ret i8* null
47 ; CHECK-NOT: @test_refscc_internal
53 ret i8* bitcast (void (i1, i8*)* @test_refscc_internal to i8*)