xref: /llvm-project/llvm/test/tools/llvm-reduce/remove-instructions.ll (revision 4982d8ac7694591d541492faac0f6d9091a18540)
1; Test that llvm-reduce can remove uninteresting instructions.
2;
3; RUN: llvm-reduce --test %python --test-arg %p/Inputs/remove-instructions.py %s -o %t
4; RUN: cat %t | FileCheck -implicit-check-not=uninteresting %s
5; REQUIRES: plugins
6
7; We're testing all direct uses of %interesting are conserved. The terminator
8; (ret) must also be preserved.
9
10; CHECK-COUNT-5: %interesting
11; CHECK: ret
12
13define i32 @main() #0 {
14entry:
15  %uninteresting1 = alloca i32, align 4
16  %interesting = alloca i32, align 4
17  %uninteresting2 = alloca i32, align 4
18  store i32 0, ptr %uninteresting1, align 4
19  store i32 0, ptr %interesting, align 4
20  %0 = load i32, ptr %interesting, align 4
21  %uninteresting3 = add nsw i32 %0, 1
22  store i32 %uninteresting3, ptr %interesting, align 4
23  %1 = load i32, ptr %interesting, align 4
24  store i32 %1, ptr %uninteresting2, align 4
25  ret i32 0
26}
27