1 ; RUN: llvm-reduce %s -o %t --delta-passes=operands-skip --test FileCheck --test-arg %s --test-arg --match-full-lines --test-arg --check-prefix=INTERESTING --test-arg --input-file
2 ; RUN: FileCheck %s --input-file %t --check-prefixes=REDUCED
4 ; INTERESTING: store i32 43, ptr {{(%imm|%indirect)}}, align 4
5 ; REDUCED: store i32 43, ptr %imm, align 4
7 ; INTERESTING: store i32 44, ptr {{(%imm|%indirect|%phi)}}, align 4
8 ; REDUCED: store i32 44, ptr %phi, align 4
10 ; INTERESTING: store i32 45, ptr {{(%imm|%indirect|%phi|%val)}}, align 4
11 ; REDUCED: store i32 45, ptr %val, align 4
13 ; INTERESTING: store i32 46, ptr {{(%imm|%indirect|%phi|%val|@Global)}}, align 4
14 ; REDUCED: store i32 46, ptr @Global, align 4
16 ; INTERESTING: store i32 47, ptr {{(%imm|%indirect|%phi|%val|@Global|%arg2)}}, align 4
17 ; REDUCED: store i32 47, ptr %arg2, align 4
19 ; INTERESTING: store i32 48, ptr {{(%imm|%indirect|%phi|%val|@Global|%arg2|%arg1)}}, align 4
20 ; REDUCED: store i32 48, ptr %arg1, align 4
22 ; INTERESTING: store i32 49, ptr {{(%imm|%indirect|%phi|%val|@Global|%arg2|%arg1|null)}}, align 4
23 ; REDUCED: store i32 49, ptr null, align 4
25 ; REDUCED: store i32 50, ptr %arg1, align 4
26 ; REDUCED: store i32 51, ptr %arg1, align 4
28 @Global = global i32 42
30 define void @func(ptr %arg1, ptr %arg2) {
32 %val = getelementptr i32, ptr getelementptr (i32, ptr @Global, i32 1), i32 2
33 br i1 undef, label %branch, label %loop
36 %nondominating1 = getelementptr i32, ptr %val, i32 3
40 %phi = phi ptr [ null, %entry ], [ %nondominating1, %branch ], [ %nondominating2, %loop ]
41 %imm = getelementptr i32, ptr %phi, i32 4
42 %indirect = getelementptr i32, ptr %imm, i32 5
44 store i32 43, ptr %imm, align 4 ; Don't reduce to %indirect (not "more reduced" than %imm)
45 store i32 44, ptr %imm, align 4 ; Reduce to %phi
46 store i32 45, ptr %imm, align 4 ; Reduce to %val
47 store i32 46, ptr %imm, align 4 ; Reduce to @Global
48 store i32 47, ptr %imm, align 4 ; Reduce to %arg1
49 store i32 48, ptr %imm, align 4 ; Reduce to %arg2
50 store i32 49, ptr %imm, align 4 ; Reduce to null
52 %nondominating2 = getelementptr i32, ptr %indirect, i32 6
53 br i1 undef, label %loop, label %exit
56 store i32 50, ptr %arg2, align 4 ; Reduce to %arg1 (compactify function arguments)
57 store i32 51, ptr %arg1, align 4 ; Don't reduce