1 ; RUN: opt < %s -simplifycfg -sink-common-insts -S | FileCheck %s
2 ; RUN: opt < %s -passes='simplify-cfg<sink-common-insts>' -S | FileCheck %s
4 define i1 @test1(i1 zeroext %flag, i8* %y) #0 {
6 br i1 %flag, label %if.then, label %if.else
9 %r = call i1 @llvm.type.test(i8* %y, metadata !0)
13 %s = call i1 @llvm.type.test(i8* %y, metadata !1)
17 %t = phi i1 [ %s, %if.else ], [ %r, %if.then ]
21 !0 = !{i32 0, !"typeid1"}
22 !1 = !{i32 4, !"typeid1"}
24 declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone
27 ; CHECK: @llvm.type.test
28 ; CHECK: @llvm.type.test
31 define i1 @test2(i1 zeroext %flag, i8* %y, i8* %z) #0 {
33 br i1 %flag, label %if.then, label %if.else
36 %r = call i1 @llvm.type.test(i8* %y, metadata !0)
40 %s = call i1 @llvm.type.test(i8* %z, metadata !0)
44 %t = phi i1 [ %s, %if.else ], [ %r, %if.then ]
49 ; CHECK: %[[S:[a-z0-9.]+]] = select i1 %flag, i8* %y, i8* %z
50 ; CHECK: %[[R:[a-z0-9.]+]] = call i1 @llvm.type.test(i8* %[[S]], metadata !0)
51 ; CHECK: ret i1 %[[R]]