2008-03-01 07:38:40 +00:00
|
|
|
; RUN: llvm-as < %s | llvm-dis > %t1.ll
|
2004-11-07 06:08:43 +00:00
|
|
|
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
|
|
|
|
; RUN: diff %t1.ll %t2.ll
|
|
|
|
|
2008-03-01 07:38:40 +00:00
|
|
|
%int = type i32
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2008-03-01 07:38:40 +00:00
|
|
|
define i32 @squared(i32 %i0) {
|
|
|
|
switch i32 %i0, label %Default [
|
|
|
|
i32 1, label %Case1
|
|
|
|
i32 2, label %Case2
|
|
|
|
i32 4, label %Case4
|
|
|
|
]
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2008-03-01 07:38:40 +00:00
|
|
|
Default: ; preds = %0
|
|
|
|
ret i32 -1
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2008-03-01 07:38:40 +00:00
|
|
|
Case1: ; preds = %0
|
|
|
|
ret i32 1
|
|
|
|
|
|
|
|
Case2: ; preds = %0
|
|
|
|
ret i32 4
|
|
|
|
|
|
|
|
Case4: ; preds = %0
|
|
|
|
ret i32 16
|
|
|
|
}
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2009-10-27 19:13:16 +00:00
|
|
|
|
2009-10-28 05:53:48 +00:00
|
|
|
@Addr = global i8* blockaddress(@indbrtest, %BB1)
|
|
|
|
@Addr3 = global i8* blockaddress(@squared, %Case1)
|
|
|
|
|
2009-10-27 19:13:16 +00:00
|
|
|
|
|
|
|
define i32 @indbrtest(i8* %P, i32* %Q) {
|
2009-10-28 00:19:10 +00:00
|
|
|
indirectbr i8* %P, [label %BB1, label %BB2, label %BB3]
|
2009-10-27 19:13:16 +00:00
|
|
|
BB1:
|
2009-10-28 00:19:10 +00:00
|
|
|
indirectbr i32* %Q, []
|
2009-10-27 19:13:16 +00:00
|
|
|
BB2:
|
2009-10-28 05:53:48 +00:00
|
|
|
%R = bitcast i8* blockaddress(@indbrtest, %BB3) to i8*
|
|
|
|
indirectbr i8* %R, [label %BB1, label %BB2, label %BB3]
|
2009-10-27 19:13:16 +00:00
|
|
|
BB3:
|
|
|
|
ret i32 2
|
|
|
|
}
|
2009-10-28 05:53:48 +00:00
|
|
|
|
|
|
|
|