Skip to content

Commit 80c6e79

Browse files
committed
[MemorySSA] LoopSimplify preserves MemorySSA only when flag is flipped.
LoopSimplify can preserve MemorySSA after r360270. But the MemorySSA analysis is retrieved and preserved only when the EnableMSSALoopDependency is set to true. Use the same conditional to mark the pass as preserved, otherwise subsequent passes will get an invalid analysis. Resolves PR41853. llvm-svn: 360697
1 parent 75ad8c5 commit 80c6e79

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

llvm/lib/Transforms/Utils/LoopSimplify.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,8 @@ namespace {
768768
AU.addPreserved<DependenceAnalysisWrapperPass>();
769769
AU.addPreservedID(BreakCriticalEdgesID); // No critical edges added.
770770
AU.addPreserved<BranchProbabilityInfoWrapperPass>();
771-
AU.addPreserved<MemorySSAWrapperPass>();
771+
if (EnableMSSALoopDependency)
772+
AU.addPreserved<MemorySSAWrapperPass>();
772773
}
773774

774775
/// verifyAnalysis() - Verify LoopSimplifyForm's guarantees.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
; RUN: opt -S -memoryssa -loop-simplify -early-cse-memssa -verify-memoryssa %s | FileCheck %s
2+
; RUN: opt -S -memoryssa -loop-simplify -early-cse-memssa -enable-mssa-loop-dependency -verify-memoryssa %s | FileCheck %s
3+
; REQUIRES: asserts
4+
target triple = "x86_64-unknown-linux-gnu"
5+
6+
; CHECK-LABEL: @func()
7+
define void @func() {
8+
br i1 undef, label %bb5, label %bb3
9+
10+
bb5: ; preds = %bb5, %0
11+
store i16 undef, i16* undef
12+
br i1 undef, label %bb5, label %bb3
13+
14+
bb3: ; preds = %bb5, %0
15+
ret void
16+
}

0 commit comments

Comments
 (0)