brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · bbf9362 Raw
57 lines · plain
1; Test that llvm-reduce can remove uninteresting Global Variables as well as2; their direct uses (which in turn are replaced with '0').3 4; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=global-variables,global-initializers --test FileCheck --test-arg --check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t5; RUN: FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL --implicit-check-not=uninteresting %s < %t6 7$interesting5 = comdat any8 9; CHECK-INTERESTINGNESS: @interesting = {{.*}}global i32{{.*}}, align 410; CHECK-INTERESTINGNESS: @interesting2 = global i32 0, align 411; CHECK-INTERESTINGNESS: @interesting3 = {{.*}}global i32{{.*}}, align 412; CHECK-INTERESTINGNESS: @interesting4 = {{.*}}constant i32{{.*}}, align 413; CHECK-INTERESTINGNESS: @interesting5 = {{.*}}global i32{{.*}}, align 414 15; CHECK-FINAL: @interesting = external global i32, align 416; CHECK-FINAL: @interesting2 = global i32 0, align 417; CHECK-FINAL: @interesting3 = external global i32, align 418; CHECK-FINAL: @interesting4 = external dso_local constant i32, align 419; CHECK-FINAL: @interesting5 = external global i32, align 420@interesting = global i32 0, align 421@interesting2 = global i32 0, align 422@interesting3 = external global i32, align 423@interesting4 = private constant i32 2, align 424@interesting5 = global i32 2, align 4, comdat25 26@uninteresting = global i32 1, align 427@uninteresting2 = external global i32, align 428 29define i32 @main() {30entry:31  %0 = load i32, ptr @uninteresting, align 432 33  ; CHECK-INTERESTINGNESS: store i32 {{.*}}, ptr @interesting, align 434  ; CHECK-FINAL: store i32 %0, ptr @interesting, align 435  store i32 %0, ptr @interesting, align 436 37  ; CHECK-INTERESTINGNESS: store i32 {{.*}}, ptr @interesting3, align 438  ; CHECK-FINAL: store i32 %0, ptr @interesting3, align 439  store i32 %0, ptr @interesting3, align 440 41  ; CHECK-ALL: load i32, ptr @interesting, align 442  %1 = load i32, ptr @interesting, align 443  store i32 %1, ptr @uninteresting, align 444 45  ; CHECK-ALL: load i32, ptr @interesting3, align 446  %2 = load i32, ptr @interesting3, align 447  store i32 %2, ptr @uninteresting2, align 448 49  ; CHECK-ALL: store i32 5, ptr @interesting, align 450  store i32 5, ptr @interesting, align 451 52  ; CHECK-ALL: store i32 5, ptr @interesting3, align 453  store i32 5, ptr @interesting3, align 454 55  ret i32 056}57