• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple=i386-apple-macosx < %s | FileCheck %s
2; rdar://12396696
3
4@JT = global [4 x i32] [i32 sub (i32 ptrtoint (i8* blockaddress(@h, %18) to i32), i32 ptrtoint (i8* blockaddress(@h, %11) to i32)), i32 sub (i32 ptrtoint (i8* blockaddress(@h, %17) to i32), i32 ptrtoint (i8* blockaddress(@h, %11) to i32)), i32 sub (i32 ptrtoint (i8* blockaddress(@h, %22) to i32), i32 ptrtoint (i8* blockaddress(@h, %18) to i32)), i32 sub (i32 ptrtoint (i8* blockaddress(@h, %22) to i32), i32 ptrtoint (i8* blockaddress(@h, %17) to i32))]
5@gGlobalLock = external global i8*
6@.str40 = external global [35 x i8]
7
8; CHECK: _JT:
9; CHECK-NOT: .long Ltmp{{[0-9]+}}-1
10; CHECK-NOT: .long 1-Ltmp{{[0-9]+}}
11; CHECK: .long Ltmp{{[0-9]+}}-Ltmp{{[0-9]+}}
12; CHECK: .long Ltmp{{[0-9]+}}-Ltmp{{[0-9]+}}
13; CHECK: .long Ltmp{{[0-9]+}}-Ltmp{{[0-9]+}}
14; CHECK: .long Ltmp{{[0-9]+}}-Ltmp{{[0-9]+}}
15
16define void @h(i8*) nounwind ssp {
17  %2 = alloca i8*
18  store i8* %0, i8** %2
19  %3 = load i8*, i8** %2
20  %4 = bitcast i8* %3 to { i32, i32 }*
21  %5 = getelementptr { i32, i32 }, { i32, i32 }* %4, i32 0, i32 0
22  %6 = load i32, i32* %5
23  %7 = srem i32 %6, 2
24  %8 = icmp slt i32 %6, 2
25  %9 = select i1 %8, i32 %6, i32 %7
26  %10 = icmp eq i32 %9, 0
27  br label %11
28
29; <label>:11                                      ; preds = %1
30  %12 = zext i1 %10 to i32
31  %13 = getelementptr [4 x i32], [4 x i32]* @JT, i32 0, i32 %12
32  %14 = load i32, i32* %13
33  %15 = add i32 %14, ptrtoint (i8* blockaddress(@h, %11) to i32)
34  %16 = inttoptr i32 %15 to i8*
35  indirectbr i8* %16, [label %17, label %18]
36
37; <label>:17                                      ; preds = %11
38  tail call void (i8*, ...) @g(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str40, i32 0, i32 0))
39  br label %22
40
41; <label>:18                                      ; preds = %11
42  %19 = call i32 @f(i32 -1037694186) nounwind
43  %20 = inttoptr i32 %19 to i32 (i8**)*
44  %21 = tail call i32 %20(i8** @gGlobalLock)
45  br label %22
46
47; <label>:22                                      ; preds = %18, %17
48  ret void
49}
50
51declare i32 @f(i32)
52
53declare void @g(i8*, ...)
54