[llvm] r314938 - Do not call Loop::getName on possibly dead loops
Sanjoy Das via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 4 15:02:27 PDT 2017
Author: sanjoy
Date: Wed Oct 4 15:02:27 2017
New Revision: 314938
URL: http://llvm.org/viewvc/llvm-project?rev=314938&view=rev
Log:
Do not call Loop::getName on possibly dead loops
This fixes PR34832.
Modified:
llvm/trunk/lib/Analysis/LoopAnalysisManager.cpp
llvm/trunk/test/Other/loop-pm-invalidation.ll
Modified: llvm/trunk/lib/Analysis/LoopAnalysisManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopAnalysisManager.cpp?rev=314938&r1=314937&r2=314938&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopAnalysisManager.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopAnalysisManager.cpp Wed Oct 4 15:02:27 2017
@@ -56,8 +56,10 @@ bool LoopAnalysisManagerFunctionProxy::R
// analysis manager's cache. So we just walk the keys and forcibly clear
// those results. Note that the order doesn't matter here as this will just
// directly destroy the results without calling methods on them.
- for (Loop *L : PreOrderLoops)
- InnerAM->clear(*L, L->getName());
+ for (Loop *L : PreOrderLoops) {
+ // NB! `L` may not be in a good enough state to run Loop::getName.
+ InnerAM->clear(*L, "<possibly invalidated loop>");
+ }
// We also need to null out the inner AM so that when the object gets
// destroyed as invalid we don't try to clear the inner AM again. At that
Modified: llvm/trunk/test/Other/loop-pm-invalidation.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/loop-pm-invalidation.ll?rev=314938&r1=314937&r2=314938&view=diff
==============================================================================
--- llvm/trunk/test/Other/loop-pm-invalidation.ll (original)
+++ llvm/trunk/test/Other/loop-pm-invalidation.ll Wed Oct 4 15:02:27 2017
@@ -57,7 +57,7 @@ define void @one_loop(i1* %ptr) {
; CHECK-LOOP-INV-NEXT: Finished {{.*}}Loop pass manager run.
; CHECK-LOOP-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}LoopAnalysis
; CHECK-LOOP-INV-NEXT: Invalidating all non-preserved analyses
-; CHECK-LOOP-INV-NEXT: Clearing all analysis results for: l0.header
+; CHECK-LOOP-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
; CHECK-LOOP-INV-NEXT: Invalidating analysis: LoopAnalysis
; CHECK-LOOP-INV-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
; CHECK-LOOP-INV-NEXT: Invalidating analysis: InnerAnalysisManagerProxy<{{.*}}Loop
@@ -84,7 +84,7 @@ define void @one_loop(i1* %ptr) {
; CHECK-SCEV-INV-NEXT: Finished {{.*}}Loop pass manager run.
; CHECK-SCEV-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ScalarEvolutionAnalysis
; CHECK-SCEV-INV-NEXT: Invalidating all non-preserved analyses
-; CHECK-SCEV-INV-NEXT: Clearing all analysis results for: l0.header
+; CHECK-SCEV-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
; CHECK-SCEV-INV-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
; CHECK-SCEV-INV-NEXT: Invalidating analysis: InnerAnalysisManagerProxy<{{.*}}Loop
; CHECK-SCEV-INV-NEXT: Running pass: FunctionToLoopPassAdaptor<{{.*}}> on one_loop
@@ -124,8 +124,8 @@ define void @nested_loops(i1* %ptr) {
; CHECK-LOOP-INV: Finished {{.*}}Loop pass manager run.
; CHECK-LOOP-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}LoopAnalysis
; CHECK-LOOP-INV-NEXT: Invalidating all non-preserved analyses
-; CHECK-LOOP-INV-NEXT: Clearing all analysis results for: l.0.header
-; CHECK-LOOP-INV-NEXT: Clearing all analysis results for: l.0.0.header
+; CHECK-LOOP-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
+; CHECK-LOOP-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
; CHECK-LOOP-INV-NEXT: Invalidating analysis: LoopAnalysis
; CHECK-LOOP-INV-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
; CHECK-LOOP-INV-NEXT: Invalidating analysis: InnerAnalysisManagerProxy<{{.*}}Loop
@@ -158,8 +158,8 @@ define void @nested_loops(i1* %ptr) {
; CHECK-SCEV-INV: Finished {{.*}}Loop pass manager run.
; CHECK-SCEV-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ScalarEvolutionAnalysis
; CHECK-SCEV-INV-NEXT: Invalidating all non-preserved analyses
-; CHECK-SCEV-INV-NEXT: Clearing all analysis results for: l.0.header
-; CHECK-SCEV-INV-NEXT: Clearing all analysis results for: l.0.0.header
+; CHECK-SCEV-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
+; CHECK-SCEV-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
; CHECK-SCEV-INV-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
; CHECK-SCEV-INV-NEXT: Invalidating analysis: InnerAnalysisManagerProxy<{{.*}}Loop
; CHECK-SCEV-INV-NEXT: Running pass: FunctionToLoopPassAdaptor<{{.*}}> on nested_loops
@@ -206,7 +206,7 @@ define void @dead_loop() {
; CHECK-LOOP-INV-NEXT: Finished {{.*}}Loop pass manager run.
; CHECK-LOOP-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}LoopAnalysis
; CHECK-LOOP-INV-NEXT: Invalidating all non-preserved analyses
-; CHECK-LOOP-INV-NEXT: Clearing all analysis results for: l0.header
+; CHECK-LOOP-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
; CHECK-LOOP-INV-NEXT: Invalidating analysis: LoopAnalysis
; CHECK-LOOP-INV-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
; CHECK-LOOP-INV-NEXT: Invalidating analysis: InnerAnalysisManagerProxy<{{.*}}Loop
@@ -233,7 +233,7 @@ define void @dead_loop() {
; CHECK-SCEV-INV-NEXT: Finished {{.*}}Loop pass manager run.
; CHECK-SCEV-INV-NEXT: Running pass: InvalidateAnalysisPass<{{.*}}ScalarEvolutionAnalysis
; CHECK-SCEV-INV-NEXT: Invalidating all non-preserved analyses
-; CHECK-SCEV-INV-NEXT: Clearing all analysis results for: l0.header
+; CHECK-SCEV-INV-NEXT: Clearing all analysis results for: <possibly invalidated loop>
; CHECK-SCEV-INV-NEXT: Invalidating analysis: ScalarEvolutionAnalysis
; CHECK-SCEV-INV-NEXT: Invalidating analysis: InnerAnalysisManagerProxy<{{.*}}Loop
; CHECK-SCEV-INV-NEXT: Running pass: FunctionToLoopPassAdaptor<{{.*}}> on dead_loop
More information about the llvm-commits
mailing list