From: Alina Sbirlea Date: Tue, 14 May 2019 18:07:18 +0000 (+0000) Subject: [MemorySSA] LoopSimplify preserves MemorySSA only when flag is flipped. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9a5c1fd7a99dc8593c94501cef4b5d2751150a46;p=llvm [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360697 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Utils/LoopSimplify.cpp b/lib/Transforms/Utils/LoopSimplify.cpp index 4fa04d473e1..5ec12aafff0 100644 --- a/lib/Transforms/Utils/LoopSimplify.cpp +++ b/lib/Transforms/Utils/LoopSimplify.cpp @@ -768,7 +768,8 @@ namespace { AU.addPreserved(); AU.addPreservedID(BreakCriticalEdgesID); // No critical edges added. AU.addPreserved(); - AU.addPreserved(); + if (EnableMSSALoopDependency) + AU.addPreserved(); } /// verifyAnalysis() - Verify LoopSimplifyForm's guarantees. diff --git a/test/Analysis/MemorySSA/pr41853.ll b/test/Analysis/MemorySSA/pr41853.ll new file mode 100644 index 00000000000..6dbc9d78262 --- /dev/null +++ b/test/Analysis/MemorySSA/pr41853.ll @@ -0,0 +1,16 @@ +; RUN: opt -S -memoryssa -loop-simplify -early-cse-memssa -verify-memoryssa %s | FileCheck %s +; RUN: opt -S -memoryssa -loop-simplify -early-cse-memssa -enable-mssa-loop-dependency -verify-memoryssa %s | FileCheck %s +; REQUIRES: asserts +target triple = "x86_64-unknown-linux-gnu" + +; CHECK-LABEL: @func() +define void @func() { + br i1 undef, label %bb5, label %bb3 + +bb5: ; preds = %bb5, %0 + store i16 undef, i16* undef + br i1 undef, label %bb5, label %bb3 + +bb3: ; preds = %bb5, %0 + ret void +}