xref: /llvm-project/llvm/test/tools/llvm-reduce/reduce-functions-blockaddress-wrong-function.ll (revision 1437a83491cbe4af1b452a3f862a6b609057c26d)
1; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=functions --test FileCheck --test-arg --check-prefixes=INTERESTING --test-arg %s --test-arg --input-file %s -o %t
2; RUN: FileCheck --check-prefixes=RESULT --input-file=%t %s
3
4; FIXME: This testcase exhibits nonsensical behavior. The first
5; function has blockaddress references. When the second function is
6; deleted, it causes the blockreferences from the first to be replaced
7; with inttoptr.
8
9; INTERESTING: @blockaddr.table.other
10
11; RESULT: @blockaddr.table.other = private unnamed_addr constant [2 x ptr] [ptr inttoptr (i32 1 to ptr), ptr inttoptr (i32 1 to ptr)]
12
13@blockaddr.table.other = private unnamed_addr constant [2 x ptr] [ptr blockaddress(@bar, %L1), ptr blockaddress(@bar, %L2)]
14
15
16; RESULT: define i32 @bar(
17define i32 @bar(i64 %arg0) {
18entry:
19  %gep = getelementptr inbounds [2 x ptr], ptr @blockaddr.table.other, i64 0, i64 %arg0
20  %load = load ptr, ptr %gep, align 8
21  indirectbr ptr %load, [label %L2, label %L1]
22
23L1:
24  %phi = phi i32 [ 1, %L2 ], [ 2, %entry ]
25  ret i32 %phi
26
27L2:
28  br label %L1
29}
30
31; RESULT-NOT: @unused
32define void @unused() {
33entry:
34  br label %exit
35
36exit:
37  ret void
38}
39