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(simplifycfg))' < %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, ptr %ptr) {
28 ; CHECK-NOT: @test_refscc_internal
30 br i1 %flag, label %then, label %else
33 call void @test_refscc_internal(i1 false, ptr @test_refscc_external)
40 define ptr @test_refscc_external() {
41 ; CHECK-LABEL: define ptr @test_refscc_external()
43 br i1 true, label %then, label %else
45 ; CHECK-NEXT: ret ptr null
47 ; CHECK-NOT: @test_refscc_internal
53 ret ptr @test_refscc_internal