|
| 1 | +; RUN: llvm-reduce %s -o %t --abort-on-invalid-reduction --delta-passes=operands-to-args --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,INTERESTING |
| 3 | + |
| 4 | +; REDUCED-LABEL: define void @func(i32 %k, i32 %extra.arg, ptr %Global, ptr %Local) { |
| 5 | + |
| 6 | +; Keep one reference to the original value. |
| 7 | +; INTERESTING: %[[LOCAL:Local[0-9]*]] = alloca i32, align 4 |
| 8 | + |
| 9 | +; Everything else must use the function argument. |
| 10 | +; REDUCED: store i32 21, ptr %Global, align 4 |
| 11 | +; REDUCED: store i32 0, ptr %Local, align 4 |
| 12 | +; REDUCED: store i32 0, ptr %Global, align 4 |
| 13 | + |
| 14 | +; Do not add any arguments for %Keep and @GlobalKeep. |
| 15 | +; INTERESTING: %[[KEEP:LocalKeep[0-9]*]] = add i32 %k, 21 |
| 16 | +; INTERESTING: store i32 %[[KEEP]], ptr @GlobalKeep, align 4 |
| 17 | + |
| 18 | +; Do not add any arguments if the call type was already mismatched |
| 19 | + |
| 20 | +; INTERESTING-LABEL: define void @mismatched_func_caller() { |
| 21 | +; REDUCED: call void @func(i32 21) |
| 22 | + |
| 23 | +@Global = global i32 42 |
| 24 | +@GlobalKeep = global i32 42 |
| 25 | + |
| 26 | +define void @func(i32 %k, i32 %extra.arg) { |
| 27 | +entry: |
| 28 | + %Local = alloca i32, align 4 |
| 29 | + store i32 21, ptr @Global, align 4 |
| 30 | + store i32 0, ptr %Local, align 4 |
| 31 | + store i32 0, ptr @Global, align 4 |
| 32 | + %LocalKeep = add i32 %k, 21 |
| 33 | + store i32 %LocalKeep, ptr @GlobalKeep, align 4 |
| 34 | + ret void |
| 35 | +} |
| 36 | + |
| 37 | +; This call has the wrong signature for the original underlying call, |
| 38 | +; so getCalledFunction does not return a reference to the function. |
| 39 | +define void @mismatched_func_caller() { |
| 40 | +entry: |
| 41 | + call void @func(i32 21) |
| 42 | + ret void |
| 43 | +} |
| 44 | + |
0 commit comments