Chandler Carruth | 082c183 | 2017-01-09 07:44:34 +0000 | [diff] [blame] | 1 | ; Test that SCEV gets invalidated when one of its dependencies is invalidated. |
| 2 | ; |
| 3 | ; Each of the RUNs checks that the pass manager runs SCEV, then invalidates it |
| 4 | ; due to a dependency being invalidated, and then re-urns it. This will |
| 5 | ; directly fail and indicates a failure that would occur later if we ddidn't |
| 6 | ; invalidate SCEV in this way. |
| 7 | |
| 8 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 9 | target triple = "x86_64-unknown-linux-gnu" |
| 10 | |
Chandler Carruth | 082c183 | 2017-01-09 07:44:34 +0000 | [diff] [blame] | 11 | ; RUN: opt < %s -passes='require<scalar-evolution>,invalidate<domtree>,print<scalar-evolution>' \ |
| 12 | ; RUN: -debug-pass-manager -disable-output 2>&1 \ |
| 13 | ; RUN: | FileCheck %s -check-prefixes=CHECK,CHECK-DT-INVALIDATE |
| 14 | ; |
| 15 | ; CHECK-DT-INVALIDATE: Running pass: RequireAnalysisPass |
| 16 | ; CHECK-DT-INVALIDATE: Running analysis: ScalarEvolutionAnalysis |
| 17 | ; CHECK-DT-INVALIDATE: Running analysis: DominatorTreeAnalysis |
| 18 | ; CHECK-DT-INVALIDATE: Running pass: InvalidateAnalysisPass |
| 19 | ; CHECK-DT-INVALIDATE: Invalidating analysis: DominatorTreeAnalysis |
| 20 | ; CHECK-DT-INVALIDATE: Running pass: ScalarEvolutionPrinterPass |
| 21 | ; CHECK-DT-INVALIDATE: Running analysis: ScalarEvolutionAnalysis |
| 22 | ; CHECK-DT-INVALIDATE: Running analysis: DominatorTreeAnalysis |
| 23 | |
| 24 | ; RUN: opt < %s -passes='require<scalar-evolution>,invalidate<loops>,print<scalar-evolution>' \ |
| 25 | ; RUN: -debug-pass-manager -disable-output 2>&1 \ |
| 26 | ; RUN: | FileCheck %s -check-prefixes=CHECK,CHECK-LI-INVALIDATE |
| 27 | ; |
| 28 | ; CHECK-LI-INVALIDATE: Running pass: RequireAnalysisPass |
| 29 | ; CHECK-LI-INVALIDATE: Running analysis: ScalarEvolutionAnalysis |
| 30 | ; CHECK-LI-INVALIDATE: Running analysis: LoopAnalysis |
| 31 | ; CHECK-LI-INVALIDATE: Running pass: InvalidateAnalysisPass |
| 32 | ; CHECK-LI-INVALIDATE: Invalidating analysis: LoopAnalysis |
| 33 | ; CHECK-LI-INVALIDATE: Running pass: ScalarEvolutionPrinterPass |
| 34 | ; CHECK-LI-INVALIDATE: Running analysis: ScalarEvolutionAnalysis |
| 35 | ; CHECK-LI-INVALIDATE: Running analysis: LoopAnalysis |
| 36 | |
| 37 | ; This test isn't particularly interesting, its just enough to make sure we |
| 38 | ; actually do some work inside of SCEV so that if we regress here despite the |
| 39 | ; debug pass printing continuing to match, ASan and other tools can catch it. |
| 40 | define void @test(i32 %n) { |
| 41 | ; CHECK-LABEL: Classifying expressions for: @test |
| 42 | ; CHECK: Loop %loop: backedge-taken count is 14 |
| 43 | ; CHECK: Loop %loop: max backedge-taken count is 14 |
| 44 | ; CHECK: Loop %loop: Predicated backedge-taken count is 14 |
| 45 | |
| 46 | entry: |
| 47 | br label %loop |
| 48 | |
| 49 | loop: |
| 50 | %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ] |
| 51 | %iv.inc = add nsw i32 %iv, 3 |
| 52 | %becond = icmp ne i32 %iv.inc, 46 |
| 53 | br i1 %becond, label %loop, label %leave |
| 54 | |
| 55 | leave: |
| 56 | ret void |
| 57 | } |