1 ; Test that llvm-reduce can remove uninteresting Global Variables as well as
2 ; their direct uses (which in turn are replaced with 'undef').
6 ; copy the test file to preserve executable bit
7 ; RUN: cp %p/Inputs/remove-global-vars.py %t/test.py
8 ; get the python path from lit
9 ; RUN: echo "#!" %python > %t/test.py
10 ; then include the rest of the test script
11 ; RUN: cat %p/Inputs/remove-global-vars.py >> %t/test.py
13 ; RUN: llvm-reduce --test %t/test.py %s -o - | FileCheck %s
16 ; CHECK: @interesting = global
17 @interesting = global i32 0, align 4
19 @uninteresting = global i32 1, align 4
23 ; CHECK-NOT: load i32, i32* @uninteresting, align 4
24 %0 = load i32, i32* @uninteresting, align 4
25 ; CHECK: store i32 undef, i32* @interesting, align 4
26 store i32 %0, i32* @interesting, align 4
28 ; CHECK: load i32, i32* @interesting, align 4
29 %1 = load i32, i32* @interesting, align 4
30 ; CHECK-NOT: store i32 %1, i32* @uninteresting, align 4
31 store i32 %1, i32* @uninteresting, align 4
33 ; CHECK: %inc = add nsw i32 undef, 1
34 %inc = add nsw i32 %0, 1
35 ; CHECK: store i32 %inc, i32* @interesting, align 4
36 store i32 %inc, i32* @interesting, align 4