llvm.org GIT mirror llvm / bfac46c
[PM][InstCombine] fixing omission of AliasAnalysis in new-pass-manager's version of InstCombine Summary: Passing AliasAnalysis results instead of nullptr appears to work just fine. A couple new-pass-manager tests updated to align with new order of analyses. Reviewers: chandlerc, spatel, craig.topper Reviewed By: chandlerc Subscribers: mehdi_amini, eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D41203 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320687 91177308-0d34-0410-b5e6-96231b3b80d8 Fedor Sergeev 1 year, 9 months ago
4 changed file(s) with 28 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
32753275
32763276 auto *LI = AM.getCachedResult(F);
32773277
3278 // FIXME: The AliasAnalysis is not yet supported in the new pass manager
3279 if (!combineInstructionsOverFunction(F, Worklist, nullptr, AC, TLI, DT, ORE,
3278 auto *AA = &AM.getResult(F);
3279 if (!combineInstructionsOverFunction(F, Worklist, AA, AC, TLI, DT, ORE,
32803280 ExpensiveCombines, LI))
32813281 // No changes, all analyses are preserved.
32823282 return PreservedAnalyses::all();
32853285 PreservedAnalyses PA;
32863286 PA.preserveSet();
32873287 PA.preserve();
3288 PA.preserve();
32883289 PA.preserve();
32893290 return PA;
32903291 }
8686 ; CHECK-O-NEXT: Starting llvm::Function pass manager run.
8787 ; CHECK-O-NEXT: Running pass: InstCombinePass
8888 ; CHECK-O-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis
89 ; CHECK-O-NEXT: Running analysis: AAManager
8990 ; CHECK-EP-PEEPHOLE-NEXT: Running pass: NoOpFunctionPass
9091 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
9192 ; CHECK-O-NEXT: Finished llvm::Function pass manager run.
102103 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph{{.*}}>
103104 ; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
104105 ; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy
105 ; CHECK-O-NEXT: Running analysis: AAManager
106106 ; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass
107107 ; CHECK-O-NEXT: Running pass: CGSCCToFunctionPassAdaptor<{{.*}}PassManager{{.*}}>
108108 ; CHECK-O-NEXT: Starting llvm::Function pass manager run.
8282 ; CHECK-O-NEXT: Starting llvm::Function pass manager run.
8383 ; CHECK-O-NEXT: Running pass: InstCombinePass
8484 ; CHECK-PRELINK-O-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis
85 ; CHECK-O-NEXT: Running analysis: AAManager
8586 ; CHECK-O-NEXT: Running pass: SimplifyCFGPass
8687 ; CHECK-O-NEXT: Finished llvm::Function pass manager run.
8788 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
9798 ; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph{{.*}}>
9899 ; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
99100 ; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy
100 ; CHECK-O-NEXT: Running analysis: AAManager
101101 ; CHECK-O3-NEXT: Running pass: ArgumentPromotionPass
102102 ; CHECK-O-NEXT: Running pass: CGSCCToFunctionPassAdaptor<{{.*}}PassManager{{.*}}>
103103 ; CHECK-O-NEXT: Starting llvm::Function pass manager run.
0 ; RUN: opt -instcombine %s -S 2>&1 | FileCheck %s
1 ; RUN: opt -aa-pipeline=basic-aa -passes=instcombine %s -S 2>&1 | FileCheck %s
2
3 ; Checking successful store-load optimization of array length.
4 ; Function below should deduce just to "return length".
5 ; Doable only if instcombine has access to alias-analysis.
6
7 define i32 @test1(i32 %length) {
8 ; CHECK-LABEL: entry:
9 entry:
10 %array = alloca i32, i32 2
11 ; CHECK-NOT: %array
12
13 %length_gep = getelementptr inbounds i32, i32 * %array, i32 0
14 %value_gep = getelementptr inbounds i32, i32 * %array, i32 1
15 store i32 %length, i32 * %length_gep
16 store i32 0, i32 * %value_gep
17 %loaded_length = load i32, i32 * %length_gep
18 ; CHECK-NOT: %loaded_length = load i32
19
20 ret i32 %loaded_length
21 ; CHECK: ret i32 %length
22 }