blob: 0e95336bbc1fe760b2387c33ef940921f0dbd539 [file] [log] [blame]
Pirama Arumuga Nainarf3ef5332016-03-03 15:48:50 -08001; RUN: opt %s -simplifycfg -S | FileCheck %s
2
3; ConstantFoldTerminator function can convert SwitchInst with one case (and default) to
4; a conditional BranchInst. This test checks the converted BranchInst preserve the
5; make.implicit metadata.
6
7declare i32 @consume(i32*)
8declare void @trap()
9
10define i32 @copy-metadata(i32* %x) {
11
12entry:
13 %x.int = ptrtoint i32* %x to i64
14
15; CHECK: br i1 %cond, label %is_null, label %default, !make.implicit !0
16 switch i64 %x.int, label %default [
17 i64 0, label %is_null
18 ], !make.implicit !0
19
20default:
21 %0 = call i32 @consume(i32* %x)
22 ret i32 %0
23
24is_null:
25 call void @trap()
26 unreachable
27}
28
29!0 = !{}
30