Chandler Carruth | 5144703 | 2017-01-23 07:53:20 +0000 | [diff] [blame] | 1 | ; Test that the inliner clears analyses which may hold references to function |
| 2 | ; bodies when it decides to delete them after inlining the last caller. |
| 3 | ; We check this by using correlated-propagation to populate LVI with basic |
| 4 | ; block references that would dangle if we failed to clear the inlined function |
| 5 | ; body. |
| 6 | ; |
| 7 | ; RUN: opt -debug-pass-manager -S < %s 2>&1 \ |
| 8 | ; RUN: -passes='cgscc(inline,function(correlated-propagation))' \ |
| 9 | ; RUN: | FileCheck %s |
| 10 | ; |
| 11 | ; CHECK-LABEL: Starting llvm::Module pass manager run. |
| 12 | ; CHECK: Running pass: InlinerPass on (callee) |
| 13 | ; CHECK: Running pass: CorrelatedValuePropagationPass on callee |
| 14 | ; CHECK: Running analysis: LazyValueAnalysis |
| 15 | ; CHECK: Running pass: InlinerPass on (caller) |
| 16 | ; CHECK: Clearing all analysis results for: callee |
| 17 | ; CHECK: Running pass: CorrelatedValuePropagationPass on caller |
| 18 | ; CHECK: Running analysis: LazyValueAnalysis |
| 19 | |
| 20 | define internal i32 @callee(i32 %x) { |
| 21 | ; CHECK-NOT: @callee |
| 22 | entry: |
| 23 | ret i32 %x |
| 24 | } |
| 25 | |
| 26 | define i32 @caller(i32 %x) { |
| 27 | ; CHECK-LABEL: define i32 @caller |
| 28 | entry: |
| 29 | %call = call i32 @callee(i32 %x) |
| 30 | ; CHECK-NOT: call |
| 31 | ret i32 %call |
| 32 | ; CHECK: ret i32 %x |
| 33 | } |