summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlina Sbirlea <asbirlea@google.com>2018-09-11 19:19:21 +0000
committerAlina Sbirlea <asbirlea@google.com>2018-09-11 19:19:21 +0000
commita496143c9e6f95e200bb71b6657cdd6431caebd2 (patch)
treea2d610cf19a08334f20a978d22fb8eb8183d5338
parente199a2d434b10b5bffacf0043f2b1d835442c4e7 (diff)
downloadbcm5719-llvm-a496143c9e6f95e200bb71b6657cdd6431caebd2.tar.gz
bcm5719-llvm-a496143c9e6f95e200bb71b6657cdd6431caebd2.zip
Update MemorySSA in LoopUnswitch.
Summary: Update MemorySSA in old LoopUnswitch pass. Actual dependency and update is disabled by default. Subscribers: sanjoy, jlebar, Prazek, llvm-commits Differential Revision: https://reviews.llvm.org/D45301 llvm-svn: 341984
-rw-r--r--llvm/lib/Transforms/Scalar/LoopUnswitch.cpp70
-rw-r--r--llvm/test/Transforms/LoopUnswitch/2006-06-13-SingleEntryPHI.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/2006-06-27-DeadSwitchCase.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/2007-05-09-Unreachable.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/2007-05-09-tl.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/2007-07-12-ExitDomInfo.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/2007-07-13-DomInfo.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/2007-07-18-DomInfo.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/2007-08-01-LCSSA.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/2008-06-02-DomInfo.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/2010-11-18-LCSSA.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/2011-09-26-EHCrash.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/2011-11-18-SimpleSwitch.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/2011-11-18-TwoSwitches-Threshold.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/2011-11-18-TwoSwitches.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/2012-04-02-IndirectBr.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/2012-05-20-Phi.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/2015-09-18-Addrspace.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/LIV-loop-condtion.ll3
-rw-r--r--llvm/test/Transforms/LoopUnswitch/basictest.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/cleanuppad.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/copy-metadata.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/crash.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/elseif-non-exponential-behavior.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/exponential-behavior.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/guards.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/infinite-loop.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/invalidate-scev.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/msan.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/pr32818.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/preserve-analyses.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/simplify-with-nonvalness.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/trivial-unswitch.ll1
-rw-r--r--llvm/test/Transforms/LoopUnswitch/unswitch-equality-undef.ll2
-rw-r--r--llvm/test/Transforms/LoopUnswitch/unswitch-select.ll1
36 files changed, 96 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
index 7531cc0f976..f67bff7fe93 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -28,18 +28,19 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
-#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/CodeMetrics.h"
-#include "llvm/Analysis/LegacyDivergenceAnalysis.h"
#include "llvm/Analysis/InstructionSimplify.h"
+#include "llvm/Analysis/LegacyDivergenceAnalysis.h"
#include "llvm/Analysis/LoopInfo.h"
+#include "llvm/Analysis/LoopIterator.h"
#include "llvm/Analysis/LoopPass.h"
+#include "llvm/Analysis/MemorySSA.h"
+#include "llvm/Analysis/MemorySSAUpdater.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/TargetTransformInfo.h"
-#include "llvm/Transforms/Utils/Local.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CallSite.h"
@@ -65,8 +66,10 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Scalar.h"
+#include "llvm/Transforms/Scalar/LoopPassManager.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Cloning.h"
+#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/LoopUtils.h"
#include "llvm/Transforms/Utils/ValueMapper.h"
#include <algorithm>
@@ -180,6 +183,8 @@ namespace {
Loop *currentLoop = nullptr;
DominatorTree *DT = nullptr;
+ MemorySSA *MSSA = nullptr;
+ std::unique_ptr<MemorySSAUpdater> MSSAU;
BasicBlock *loopHeader = nullptr;
BasicBlock *loopPreheader = nullptr;
@@ -214,6 +219,10 @@ namespace {
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<AssumptionCacheTracker>();
AU.addRequired<TargetTransformInfoWrapperPass>();
+ if (EnableMSSALoopDependency) {
+ AU.addRequired<MemorySSAWrapperPass>();
+ AU.addPreserved<MemorySSAWrapperPass>();
+ }
if (hasBranchDivergence)
AU.addRequired<LegacyDivergenceAnalysis>();
getLoopAnalysisUsage(AU);
@@ -384,6 +393,7 @@ INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
INITIALIZE_PASS_DEPENDENCY(LoopPass)
INITIALIZE_PASS_DEPENDENCY(TargetTransformInfoWrapperPass)
INITIALIZE_PASS_DEPENDENCY(LegacyDivergenceAnalysis)
+INITIALIZE_PASS_DEPENDENCY(MemorySSAWrapperPass)
INITIALIZE_PASS_END(LoopUnswitch, "loop-unswitch", "Unswitch loops",
false, false)
@@ -515,6 +525,11 @@ bool LoopUnswitch::runOnLoop(Loop *L, LPPassManager &LPM_Ref) {
LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
LPM = &LPM_Ref;
DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
+ if (EnableMSSALoopDependency) {
+ MSSA = &getAnalysis<MemorySSAWrapperPass>().getMSSA();
+ MSSAU = make_unique<MemorySSAUpdater>(MSSA);
+ assert(DT && "Cannot update MemorySSA without a valid DomTree.");
+ }
currentLoop = L;
Function *F = currentLoop->getHeader()->getParent();
@@ -522,13 +537,21 @@ bool LoopUnswitch::runOnLoop(Loop *L, LPPassManager &LPM_Ref) {
if (SanitizeMemory)
SafetyInfo.computeLoopSafetyInfo(L);
+ if (MSSA && VerifyMemorySSA)
+ MSSA->verifyMemorySSA();
+
bool Changed = false;
do {
assert(currentLoop->isLCSSAForm(*DT));
+ if (MSSA && VerifyMemorySSA)
+ MSSA->verifyMemorySSA();
redoLoop = false;
Changed |= processCurrentLoop();
} while(redoLoop);
+ if (MSSA && VerifyMemorySSA)
+ MSSA->verifyMemorySSA();
+
return Changed;
}
@@ -952,13 +975,16 @@ void LoopUnswitch::EmitPreheaderBranchOnCondition(Value *LIC, Constant *Val,
if (OldBranchSucc != TrueDest && OldBranchSucc != FalseDest) {
Updates.push_back({DominatorTree::Delete, OldBranchParent, OldBranchSucc});
}
-
DT->applyUpdates(Updates);
+
+ if (MSSAU)
+ MSSAU->applyUpdates(Updates, *DT);
}
// If either edge is critical, split it. This helps preserve LoopSimplify
// form for enclosing loops.
- auto Options = CriticalEdgeSplittingOptions(DT, LI).setPreserveLCSSA();
+ auto Options =
+ CriticalEdgeSplittingOptions(DT, LI, MSSAU.get()).setPreserveLCSSA();
SplitCriticalEdge(BI, 0, Options);
SplitCriticalEdge(BI, 1, Options);
}
@@ -984,7 +1010,7 @@ void LoopUnswitch::UnswitchTrivialCondition(Loop *L, Value *Cond, Constant *Val,
// First step, split the preheader, so that we know that there is a safe place
// to insert the conditional branch. We will change loopPreheader to have a
// conditional branch on Cond.
- BasicBlock *NewPH = SplitEdge(loopPreheader, loopHeader, DT, LI);
+ BasicBlock *NewPH = SplitEdge(loopPreheader, loopHeader, DT, LI, MSSAU.get());
// Now that we have a place to insert the conditional branch, create a place
// to branch to: this is the exit block out of the loop that we should
@@ -995,7 +1021,8 @@ void LoopUnswitch::UnswitchTrivialCondition(Loop *L, Value *Cond, Constant *Val,
// without actually branching to it (the exit block should be dominated by the
// loop header, not the preheader).
assert(!L->contains(ExitBlock) && "Exit block is in the loop?");
- BasicBlock *NewExit = SplitBlock(ExitBlock, &ExitBlock->front(), DT, LI);
+ BasicBlock *NewExit =
+ SplitBlock(ExitBlock, &ExitBlock->front(), DT, LI, MSSAU.get());
// Okay, now we have a position to branch from and a position to branch to,
// insert the new conditional branch.
@@ -1015,6 +1042,7 @@ void LoopUnswitch::UnswitchTrivialCondition(Loop *L, Value *Cond, Constant *Val,
// particular value, rewrite the loop with this info. We know that this will
// at least eliminate the old branch.
RewriteLoopBodyWithConditionConstant(L, Cond, Val, false);
+
++NumTrivial;
}
@@ -1190,7 +1218,7 @@ void LoopUnswitch::SplitExitEdges(Loop *L,
// Although SplitBlockPredecessors doesn't preserve loop-simplify in
// general, if we call it on all predecessors of all exits then it does.
- SplitBlockPredecessors(ExitBlock, Preds, ".us-lcssa", DT, LI, nullptr,
+ SplitBlockPredecessors(ExitBlock, Preds, ".us-lcssa", DT, LI, MSSAU.get(),
/*PreserveLCSSA*/ true);
}
}
@@ -1216,7 +1244,8 @@ void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val,
// First step, split the preheader and exit blocks, and add these blocks to
// the LoopBlocks list.
- BasicBlock *NewPreheader = SplitEdge(loopPreheader, loopHeader, DT, LI);
+ BasicBlock *NewPreheader =
+ SplitEdge(loopPreheader, loopHeader, DT, LI, MSSAU.get());
LoopBlocks.push_back(NewPreheader);
// We want the loop to come after the preheader, but before the exit blocks.
@@ -1318,10 +1347,24 @@ void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val,
assert(OldBR->isUnconditional() && OldBR->getSuccessor(0) == LoopBlocks[0] &&
"Preheader splitting did not work correctly!");
+ if (MSSAU) {
+ // Update MemorySSA after cloning, and before splitting to unreachables,
+ // since that invalidates the 1:1 mapping of clones in VMap.
+ LoopBlocksRPO LBRPO(L);
+ LBRPO.perform(LI);
+ MSSAU->updateForClonedLoop(LBRPO, ExitBlocks, VMap);
+ }
+
// Emit the new branch that selects between the two versions of this loop.
EmitPreheaderBranchOnCondition(LIC, Val, NewBlocks[0], LoopBlocks[0], OldBR,
TI);
LPM->deleteSimpleAnalysisValue(OldBR, L);
+ if (MSSAU) {
+ // Update MemoryPhis in Exit blocks.
+ MSSAU->updateExitBlocksForClonedLoop(ExitBlocks, VMap, *DT);
+ if (VerifyMemorySSA)
+ MSSA->verifyMemorySSA();
+ }
// The OldBr was replaced by a new one and removed (but not erased) by
// EmitPreheaderBranchOnCondition. It is no longer needed, so delete it.
@@ -1347,6 +1390,9 @@ void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val,
if (!LoopProcessWorklist.empty() && LoopProcessWorklist.back() == NewLoop &&
LICHandle && !isa<Constant>(LICHandle))
RewriteLoopBodyWithConditionConstant(NewLoop, LICHandle, Val, true);
+
+ if (MSSA && VerifyMemorySSA)
+ MSSA->verifyMemorySSA();
}
/// Remove all instances of I from the worklist vector specified.
@@ -1485,7 +1531,7 @@ void LoopUnswitch::RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC,
// and hooked up so as to preserve the loop structure, because
// trying to update it is complicated. So instead we preserve the
// loop structure and put the block on a dead code path.
- SplitEdge(Switch, SISucc, DT, LI);
+ SplitEdge(Switch, SISucc, DT, LI, MSSAU.get());
// Compute the successors instead of relying on the return value
// of SplitEdge, since it may have split the switch successor
// after PHI nodes.
@@ -1539,6 +1585,8 @@ void LoopUnswitch::SimplifyCode(std::vector<Instruction*> &Worklist, Loop *L) {
Worklist.push_back(Use);
LPM->deleteSimpleAnalysisValue(I, L);
RemoveFromWorklist(I, Worklist);
+ if (MSSAU)
+ MSSAU->removeMemoryAccess(I);
I->eraseFromParent();
++NumSimplify;
continue;
@@ -1578,6 +1626,8 @@ void LoopUnswitch::SimplifyCode(std::vector<Instruction*> &Worklist, Loop *L) {
// Move all of the successor contents from Succ to Pred.
Pred->getInstList().splice(BI->getIterator(), Succ->getInstList(),
Succ->begin(), Succ->end());
+ if (MSSAU)
+ MSSAU->moveAllAfterMergeBlocks(Succ, Pred, BI);
LPM->deleteSimpleAnalysisValue(BI, L);
RemoveFromWorklist(BI, Worklist);
BI->eraseFromParent();
diff --git a/llvm/test/Transforms/LoopUnswitch/2006-06-13-SingleEntryPHI.ll b/llvm/test/Transforms/LoopUnswitch/2006-06-13-SingleEntryPHI.ll
index e0301572821..c586323b4b8 100644
--- a/llvm/test/Transforms/LoopUnswitch/2006-06-13-SingleEntryPHI.ll
+++ b/llvm/test/Transforms/LoopUnswitch/2006-06-13-SingleEntryPHI.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -loop-unswitch -disable-output
+; RUN: opt < %s -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -disable-output
%struct.BLEND_MAP = type { i16, i16, i16, i32, %struct.BLEND_MAP_ENTRY* }
%struct.BLEND_MAP_ENTRY = type { float, i8, { [5 x float], [4 x i8] } }
diff --git a/llvm/test/Transforms/LoopUnswitch/2006-06-27-DeadSwitchCase.ll b/llvm/test/Transforms/LoopUnswitch/2006-06-27-DeadSwitchCase.ll
index fd4d7300b44..65170b5957b 100644
--- a/llvm/test/Transforms/LoopUnswitch/2006-06-27-DeadSwitchCase.ll
+++ b/llvm/test/Transforms/LoopUnswitch/2006-06-27-DeadSwitchCase.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -loop-unswitch -disable-output
+; RUN: opt < %s -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -disable-output
define void @init_caller_save() {
entry:
diff --git a/llvm/test/Transforms/LoopUnswitch/2007-05-09-Unreachable.ll b/llvm/test/Transforms/LoopUnswitch/2007-05-09-Unreachable.ll
index 468b1943069..05f6b8075e1 100644
--- a/llvm/test/Transforms/LoopUnswitch/2007-05-09-Unreachable.ll
+++ b/llvm/test/Transforms/LoopUnswitch/2007-05-09-Unreachable.ll
@@ -1,5 +1,6 @@
; PR1333
; RUN: opt < %s -loop-unswitch -disable-output
+; RUN: opt < %s -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -disable-output
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
target triple = "i686-pc-linux-gnu"
diff --git a/llvm/test/Transforms/LoopUnswitch/2007-05-09-tl.ll b/llvm/test/Transforms/LoopUnswitch/2007-05-09-tl.ll
index 61615d0cc52..75171d43a93 100644
--- a/llvm/test/Transforms/LoopUnswitch/2007-05-09-tl.ll
+++ b/llvm/test/Transforms/LoopUnswitch/2007-05-09-tl.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -loop-unswitch -disable-output
+; RUN: opt < %s -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -disable-output
; PR1333
define void @pp_cxx_expression() {
diff --git a/llvm/test/Transforms/LoopUnswitch/2007-07-12-ExitDomInfo.ll b/llvm/test/Transforms/LoopUnswitch/2007-07-12-ExitDomInfo.ll
index 9da8dc2f3e8..a2da514727b 100644
--- a/llvm/test/Transforms/LoopUnswitch/2007-07-12-ExitDomInfo.ll
+++ b/llvm/test/Transforms/LoopUnswitch/2007-07-12-ExitDomInfo.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -loop-unswitch -instcombine -disable-output
+; RUN: opt < %s -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -instcombine -disable-output
@str3 = external constant [3 x i8] ; <[3 x i8]*> [#uses=1]
diff --git a/llvm/test/Transforms/LoopUnswitch/2007-07-13-DomInfo.ll b/llvm/test/Transforms/LoopUnswitch/2007-07-13-DomInfo.ll
index 5ae335bb666..6b837d8ee06 100644
--- a/llvm/test/Transforms/LoopUnswitch/2007-07-13-DomInfo.ll
+++ b/llvm/test/Transforms/LoopUnswitch/2007-07-13-DomInfo.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -loop-unswitch -disable-output
+; RUN: opt < %s -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -disable-output
define i32 @main(i32 %argc, i8** %argv) {
entry:
diff --git a/llvm/test/Transforms/LoopUnswitch/2007-07-18-DomInfo.ll b/llvm/test/Transforms/LoopUnswitch/2007-07-18-DomInfo.ll
index c01bed142fc..6414ef1eb57 100644
--- a/llvm/test/Transforms/LoopUnswitch/2007-07-18-DomInfo.ll
+++ b/llvm/test/Transforms/LoopUnswitch/2007-07-18-DomInfo.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -loop-unswitch -disable-output
+; RUN: opt < %s -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -disable-output
; PR1559
target triple = "i686-pc-linux-gnu"
diff --git a/llvm/test/Transforms/LoopUnswitch/2007-08-01-LCSSA.ll b/llvm/test/Transforms/LoopUnswitch/2007-08-01-LCSSA.ll
index 49b30bda50f..547c633f9da 100644
--- a/llvm/test/Transforms/LoopUnswitch/2007-08-01-LCSSA.ll
+++ b/llvm/test/Transforms/LoopUnswitch/2007-08-01-LCSSA.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -loop-unswitch -instcombine -disable-output
+; RUN: opt < %s -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -instcombine -disable-output
%struct.ClassDef = type { %struct.QByteArray, %struct.QByteArray, %"struct.QList<ArgumentDef>", %"struct.QList<ArgumentDef>", i8, i8, %"struct.QList<ArgumentDef>", %"struct.QList<ArgumentDef>", %"struct.QList<ArgumentDef>", %"struct.QList<ArgumentDef>", %"struct.QList<ArgumentDef>", %"struct.QList<ArgumentDef>", %"struct.QMap<QByteArray,QByteArray>", %"struct.QList<ArgumentDef>", %"struct.QMap<QByteArray,QByteArray>", i32, i32 }
%struct.FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct.FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i32, i32, [40 x i8] }
%struct.Generator = type { %struct.FILE*, %struct.ClassDef*, %"struct.QList<ArgumentDef>", %struct.QByteArray, %"struct.QList<ArgumentDef>" }
diff --git a/llvm/test/Transforms/LoopUnswitch/2008-06-02-DomInfo.ll b/llvm/test/Transforms/LoopUnswitch/2008-06-02-DomInfo.ll
index 8ea4ed33fc5..165156657d7 100644
--- a/llvm/test/Transforms/LoopUnswitch/2008-06-02-DomInfo.ll
+++ b/llvm/test/Transforms/LoopUnswitch/2008-06-02-DomInfo.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -loop-unswitch -instcombine -gvn -disable-output
+; RUN: opt < %s -loop-unswitch -instcombine -gvn -enable-mssa-loop-dependency=true -verify-memoryssa -disable-output
; PR2372
target triple = "i386-pc-linux-gnu"
diff --git a/llvm/test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll b/llvm/test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll
index 6790cf6a00d..22d6acde84c 100644
--- a/llvm/test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll
+++ b/llvm/test/Transforms/LoopUnswitch/2008-11-03-Invariant.ll
@@ -1,5 +1,6 @@
; REQUIRES: asserts
; RUN: opt < %s -loop-unswitch -stats -disable-output 2>&1 | FileCheck %s
+; RUN: opt < %s -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -stats -disable-output 2>&1 | FileCheck %s
; PR 3170
define i32 @a(i32 %x, i32 %y) nounwind {
diff --git a/llvm/test/Transforms/LoopUnswitch/2010-11-18-LCSSA.ll b/llvm/test/Transforms/LoopUnswitch/2010-11-18-LCSSA.ll
index 3b89fa91583..55012720f6b 100644
--- a/llvm/test/Transforms/LoopUnswitch/2010-11-18-LCSSA.ll
+++ b/llvm/test/Transforms/LoopUnswitch/2010-11-18-LCSSA.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -loop-unswitch
+; RUN: opt < %s -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa
; PR8622
@g_38 = external global i32, align 4
diff --git a/llvm/test/Transforms/LoopUnswitch/2011-09-26-EHCrash.ll b/llvm/test/Transforms/LoopUnswitch/2011-09-26-EHCrash.ll
index 5d763a9b3e7..cdb55f57472 100644
--- a/llvm/test/Transforms/LoopUnswitch/2011-09-26-EHCrash.ll
+++ b/llvm/test/Transforms/LoopUnswitch/2011-09-26-EHCrash.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -sroa -loop-unswitch -disable-output
+; RUN: opt < %s -sroa -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -disable-output
; PR11016
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-apple-macosx10.7.2"
diff --git a/llvm/test/Transforms/LoopUnswitch/2011-11-18-SimpleSwitch.ll b/llvm/test/Transforms/LoopUnswitch/2011-11-18-SimpleSwitch.ll
index d115787b6ea..2db66aca089 100644
--- a/llvm/test/Transforms/LoopUnswitch/2011-11-18-SimpleSwitch.ll
+++ b/llvm/test/Transforms/LoopUnswitch/2011-11-18-SimpleSwitch.ll
@@ -1,6 +1,7 @@
; REQUIRES: asserts
; RUN: opt -loop-unswitch -disable-output -stats -info-output-file - < %s | FileCheck --check-prefix=STATS %s
; RUN: opt -S -loop-unswitch -verify-loop-info -verify-dom-info < %s | FileCheck %s
+; RUN: opt -S -loop-unswitch -verify-loop-info -verify-dom-info -enable-mssa-loop-dependency=true -verify-memoryssa < %s | FileCheck %s
; STATS: 2 loop-unswitch - Number of switches unswitched
diff --git a/llvm/test/Transforms/LoopUnswitch/2011-11-18-TwoSwitches-Threshold.ll b/llvm/test/Transforms/LoopUnswitch/2011-11-18-TwoSwitches-Threshold.ll
index c4e8d6f8898..012916cc243 100644
--- a/llvm/test/Transforms/LoopUnswitch/2011-11-18-TwoSwitches-Threshold.ll
+++ b/llvm/test/Transforms/LoopUnswitch/2011-11-18-TwoSwitches-Threshold.ll
@@ -1,6 +1,7 @@
; REQUIRES: asserts
; RUN: opt -loop-unswitch -loop-unswitch-threshold 13 -disable-output -stats -info-output-file - < %s | FileCheck --check-prefix=STATS %s
; RUN: opt -S -loop-unswitch -loop-unswitch-threshold 13 -verify-loop-info -verify-dom-info < %s | FileCheck %s
+; RUN: opt -S -loop-unswitch -loop-unswitch-threshold 13 -verify-loop-info -verify-dom-info -enable-mssa-loop-dependency=true -verify-memoryssa < %s | FileCheck %s
; STATS: 1 loop-unswitch - Number of switches unswitched
diff --git a/llvm/test/Transforms/LoopUnswitch/2011-11-18-TwoSwitches.ll b/llvm/test/Transforms/LoopUnswitch/2011-11-18-TwoSwitches.ll
index 18e544d86ca..04852034225 100644
--- a/llvm/test/Transforms/LoopUnswitch/2011-11-18-TwoSwitches.ll
+++ b/llvm/test/Transforms/LoopUnswitch/2011-11-18-TwoSwitches.ll
@@ -1,6 +1,7 @@
; REQUIRES: asserts
; RUN: opt -loop-unswitch -loop-unswitch-threshold 1000 -disable-output -stats -info-output-file - < %s | FileCheck --check-prefix=STATS %s
; RUN: opt -S -loop-unswitch -loop-unswitch-threshold 1000 -verify-loop-info -verify-dom-info < %s | FileCheck %s
+; RUN: opt -S -loop-unswitch -loop-unswitch-threshold 1000 -verify-loop-info -verify-dom-info -enable-mssa-loop-dependency=true -verify-memoryssa < %s | FileCheck %s
; STATS: 3 loop-unswitch - Number of switches unswitched
diff --git a/llvm/test/Transforms/LoopUnswitch/2012-04-02-IndirectBr.ll b/llvm/test/Transforms/LoopUnswitch/2012-04-02-IndirectBr.ll
index c92f0a2be3f..8ccf4452388 100644
--- a/llvm/test/Transforms/LoopUnswitch/2012-04-02-IndirectBr.ll
+++ b/llvm/test/Transforms/LoopUnswitch/2012-04-02-IndirectBr.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -S -loop-unswitch -verify-loop-info -verify-dom-info | FileCheck %s
+; RUN: opt < %s -S -loop-unswitch -verify-loop-info -verify-dom-info -enable-mssa-loop-dependency=true -verify-memoryssa | FileCheck %s
; PR12343: -loop-unswitch crash on indirect branch
; CHECK: %0 = icmp eq i64 undef, 0
diff --git a/llvm/test/Transforms/LoopUnswitch/2012-05-20-Phi.ll b/llvm/test/Transforms/LoopUnswitch/2012-05-20-Phi.ll
index 96bc28c9a35..f5e6af9db38 100644
--- a/llvm/test/Transforms/LoopUnswitch/2012-05-20-Phi.ll
+++ b/llvm/test/Transforms/LoopUnswitch/2012-05-20-Phi.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -loop-unswitch -disable-output
+; RUN: opt < %s -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -disable-output
; PR12887
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
diff --git a/llvm/test/Transforms/LoopUnswitch/2015-09-18-Addrspace.ll b/llvm/test/Transforms/LoopUnswitch/2015-09-18-Addrspace.ll
index 0f74614da98..62236b4dd86 100644
--- a/llvm/test/Transforms/LoopUnswitch/2015-09-18-Addrspace.ll
+++ b/llvm/test/Transforms/LoopUnswitch/2015-09-18-Addrspace.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -loop-unswitch -S | FileCheck %s
+; RUN: opt < %s -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -S | FileCheck %s
; In cases where two address spaces do not have the same size pointer, the
; input for the addrspacecast should not be used as a substitute for itself
diff --git a/llvm/test/Transforms/LoopUnswitch/LIV-loop-condtion.ll b/llvm/test/Transforms/LoopUnswitch/LIV-loop-condtion.ll
index dd436f474ea..bf4b68c1d2e 100644
--- a/llvm/test/Transforms/LoopUnswitch/LIV-loop-condtion.ll
+++ b/llvm/test/Transforms/LoopUnswitch/LIV-loop-condtion.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -loop-unswitch -loop-unswitch-threshold=0 -S 2>&1 | FileCheck %s
+; RUN: opt < %s -loop-unswitch -loop-unswitch-threshold=0 -enable-mssa-loop-dependency=true -verify-memoryssa -S 2>&1 | FileCheck %s
; This is to test trivial loop unswitch only happens when trivial condition
; itself is an LIV loop condition (not partial LIV which could occur in and/or).
@@ -25,4 +26,4 @@ loop_exit:
ret i32 0
}
-declare void @some_func() noreturn \ No newline at end of file
+declare void @some_func() noreturn
diff --git a/llvm/test/Transforms/LoopUnswitch/basictest.ll b/llvm/test/Transforms/LoopUnswitch/basictest.ll
index 3add848395a..539abd838cf 100644
--- a/llvm/test/Transforms/LoopUnswitch/basictest.ll
+++ b/llvm/test/Transforms/LoopUnswitch/basictest.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -loop-unswitch -verify-loop-info -S < %s 2>&1 | FileCheck %s
+; RUN: opt < %s -loop-unswitch -verify-loop-info -enable-mssa-loop-dependency=true -verify-memoryssa -S < %s 2>&1 | FileCheck %s
define i32 @test(i32* %A, i1 %C) {
entry:
diff --git a/llvm/test/Transforms/LoopUnswitch/cleanuppad.ll b/llvm/test/Transforms/LoopUnswitch/cleanuppad.ll
index b06ebd7235c..80b913b1035 100644
--- a/llvm/test/Transforms/LoopUnswitch/cleanuppad.ll
+++ b/llvm/test/Transforms/LoopUnswitch/cleanuppad.ll
@@ -1,4 +1,5 @@
; RUN: opt -S -loop-unswitch < %s | FileCheck %s
+; RUN: opt -S -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa < %s | FileCheck %s
target triple = "x86_64-pc-win32"
define void @f(i32 %doit, i1 %x, i1 %y) personality i32 (...)* @__CxxFrameHandler3 {
diff --git a/llvm/test/Transforms/LoopUnswitch/copy-metadata.ll b/llvm/test/Transforms/LoopUnswitch/copy-metadata.ll
index 3302bce9a6e..6b5b93dedf9 100644
--- a/llvm/test/Transforms/LoopUnswitch/copy-metadata.ll
+++ b/llvm/test/Transforms/LoopUnswitch/copy-metadata.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -loop-unswitch -S < %s 2>&1 | FileCheck %s
+; RUN: opt < %s -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -S < %s 2>&1 | FileCheck %s
; This test checks if unswitched condition preserve make.implicit metadata.
diff --git a/llvm/test/Transforms/LoopUnswitch/crash.ll b/llvm/test/Transforms/LoopUnswitch/crash.ll
index b273a123c39..6df3e7f3eb0 100644
--- a/llvm/test/Transforms/LoopUnswitch/crash.ll
+++ b/llvm/test/Transforms/LoopUnswitch/crash.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -loop-unswitch -disable-output
+; RUN: opt < %s -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -disable-output
define void @test1(i32* %S2) {
entry:
diff --git a/llvm/test/Transforms/LoopUnswitch/elseif-non-exponential-behavior.ll b/llvm/test/Transforms/LoopUnswitch/elseif-non-exponential-behavior.ll
index 81897d872cd..b328aaae973 100644
--- a/llvm/test/Transforms/LoopUnswitch/elseif-non-exponential-behavior.ll
+++ b/llvm/test/Transforms/LoopUnswitch/elseif-non-exponential-behavior.ll
@@ -1,4 +1,5 @@
; RUN: opt -loop-unswitch -S - < %s | FileCheck %s
+; RUN: opt -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -S - < %s | FileCheck %s
;CHECK-LABEL: @b
;CHECK: [[Loop1:for\.end.*]]: ; preds = %for.cond.us
diff --git a/llvm/test/Transforms/LoopUnswitch/exponential-behavior.ll b/llvm/test/Transforms/LoopUnswitch/exponential-behavior.ll
index fb5a1ccf87b..9dfa61e028c 100644
--- a/llvm/test/Transforms/LoopUnswitch/exponential-behavior.ll
+++ b/llvm/test/Transforms/LoopUnswitch/exponential-behavior.ll
@@ -1,4 +1,5 @@
; RUN: opt -loop-unswitch -S < %s | FileCheck %s
+; RUN: opt -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -S < %s | FileCheck %s
define void @f(i32 %n, i32* %ptr) {
; CHECK-LABEL: @f(
diff --git a/llvm/test/Transforms/LoopUnswitch/guards.ll b/llvm/test/Transforms/LoopUnswitch/guards.ll
index 55885338960..957ea1a7900 100644
--- a/llvm/test/Transforms/LoopUnswitch/guards.ll
+++ b/llvm/test/Transforms/LoopUnswitch/guards.ll
@@ -1,4 +1,5 @@
; RUN: opt -S -loop-unswitch < %s | FileCheck %s
+; RUN: opt -S -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa < %s | FileCheck %s
declare void @llvm.experimental.guard(i1, ...)
diff --git a/llvm/test/Transforms/LoopUnswitch/infinite-loop.ll b/llvm/test/Transforms/LoopUnswitch/infinite-loop.ll
index 013355faf35..f11aa50e634 100644
--- a/llvm/test/Transforms/LoopUnswitch/infinite-loop.ll
+++ b/llvm/test/Transforms/LoopUnswitch/infinite-loop.ll
@@ -1,5 +1,6 @@
; REQUIRES: asserts
; RUN: opt -loop-unswitch -disable-output -stats -info-output-file - < %s | FileCheck --check-prefix=STATS %s
+; RUN: opt -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -disable-output -stats -info-output-file - < %s | FileCheck --check-prefix=STATS %s
; RUN: opt -loop-unswitch -simplifycfg -S < %s | FileCheck %s
; PR5373
diff --git a/llvm/test/Transforms/LoopUnswitch/invalidate-scev.ll b/llvm/test/Transforms/LoopUnswitch/invalidate-scev.ll
index f1e9443556a..78ef4f00abc 100644
--- a/llvm/test/Transforms/LoopUnswitch/invalidate-scev.ll
+++ b/llvm/test/Transforms/LoopUnswitch/invalidate-scev.ll
@@ -1,4 +1,5 @@
; RUN: opt -S -indvars -loop-unswitch < %s | FileCheck %s
+; RUN: opt -S -indvars -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa < %s | FileCheck %s
target triple = "x86_64-unknown-linux-gnu"
diff --git a/llvm/test/Transforms/LoopUnswitch/msan.ll b/llvm/test/Transforms/LoopUnswitch/msan.ll
index a5e10e828a7..194e64687be 100644
--- a/llvm/test/Transforms/LoopUnswitch/msan.ll
+++ b/llvm/test/Transforms/LoopUnswitch/msan.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -loop-unswitch -verify-loop-info -S < %s 2>&1 | FileCheck %s
+; RUN: opt < %s -loop-unswitch -verify-loop-info -enable-mssa-loop-dependency=true -verify-memoryssa -S < %s 2>&1 | FileCheck %s
@sink = global i32 0, align 4
@y = global i64 0, align 8
diff --git a/llvm/test/Transforms/LoopUnswitch/pr32818.ll b/llvm/test/Transforms/LoopUnswitch/pr32818.ll
index cda66c9dd36..ed33494f59c 100644
--- a/llvm/test/Transforms/LoopUnswitch/pr32818.ll
+++ b/llvm/test/Transforms/LoopUnswitch/pr32818.ll
@@ -1,6 +1,7 @@
; Check that the call doesn't get removed even if
; it has no uses. It could have side-effects.
; RUN: opt -loop-unswitch -S %s | FileCheck %s
+; RUN: opt -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -S %s | FileCheck %s
; CHECK-LABEL: @tinky
define i32 @tinkywinky(i8 %patatino) {
diff --git a/llvm/test/Transforms/LoopUnswitch/preserve-analyses.ll b/llvm/test/Transforms/LoopUnswitch/preserve-analyses.ll
index e3774a1e907..d731fba34a1 100644
--- a/llvm/test/Transforms/LoopUnswitch/preserve-analyses.ll
+++ b/llvm/test/Transforms/LoopUnswitch/preserve-analyses.ll
@@ -1,4 +1,5 @@
; RUN: opt -loop-unswitch -verify-loop-info -verify-dom-info -disable-output < %s
+; RUN: opt -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -verify-loop-info -verify-dom-info -disable-output < %s
; Loop unswitch should be able to unswitch these loops and
; preserve LCSSA and LoopSimplify forms.
diff --git a/llvm/test/Transforms/LoopUnswitch/simplify-with-nonvalness.ll b/llvm/test/Transforms/LoopUnswitch/simplify-with-nonvalness.ll
index d033b083a1b..d2436f06e0c 100644
--- a/llvm/test/Transforms/LoopUnswitch/simplify-with-nonvalness.ll
+++ b/llvm/test/Transforms/LoopUnswitch/simplify-with-nonvalness.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -loop-unswitch -verify-loop-info -S < %s 2>&1 | FileCheck %s
+; RUN: opt < %s -loop-unswitch -verify-loop-info -enable-mssa-loop-dependency=true -verify-memoryssa -S < %s 2>&1 | FileCheck %s
; There are 1 case and 1 default case in the switch. after we unswitch, we know the
; %a is definitely not 0 in one of the unswitched loop, make sure we take advantage
diff --git a/llvm/test/Transforms/LoopUnswitch/trivial-unswitch.ll b/llvm/test/Transforms/LoopUnswitch/trivial-unswitch.ll
index 2def5b6f033..c820a53d991 100644
--- a/llvm/test/Transforms/LoopUnswitch/trivial-unswitch.ll
+++ b/llvm/test/Transforms/LoopUnswitch/trivial-unswitch.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -loop-unswitch -loop-unswitch-threshold=0 -verify-loop-info -S < %s 2>&1 | FileCheck %s
+; RUN: opt < %s -loop-unswitch -loop-unswitch-threshold=0 -verify-loop-info -enable-mssa-loop-dependency=true -verify-memoryssa -S < %s 2>&1 | FileCheck %s
; This test contains two trivial unswitch condition in one loop.
; LoopUnswitch pass should be able to unswitch the second one
diff --git a/llvm/test/Transforms/LoopUnswitch/unswitch-equality-undef.ll b/llvm/test/Transforms/LoopUnswitch/unswitch-equality-undef.ll
index de0ca182dd8..c6b49c7281d 100644
--- a/llvm/test/Transforms/LoopUnswitch/unswitch-equality-undef.ll
+++ b/llvm/test/Transforms/LoopUnswitch/unswitch-equality-undef.ll
@@ -1,5 +1,5 @@
; REQUIRES: asserts
-; RUN: opt < %s -instcombine -licm -loop-unswitch -loop-unswitch-threshold=1000 -disable-output -stats 2>&1| FileCheck %s
+; RUN: opt < %s -instcombine -licm -loop-unswitch -loop-unswitch-threshold=1000 -enable-mssa-loop-dependency=true -verify-memoryssa -disable-output -stats 2>&1| FileCheck %s
; Check no loop unswitch is done because unswitching of equality expr with
; undef is unsafe before the freeze patch is committed.
; CHECK-NOT: Number of branches unswitched
diff --git a/llvm/test/Transforms/LoopUnswitch/unswitch-select.ll b/llvm/test/Transforms/LoopUnswitch/unswitch-select.ll
index 1caac5af1cf..7b62587f53f 100644
--- a/llvm/test/Transforms/LoopUnswitch/unswitch-select.ll
+++ b/llvm/test/Transforms/LoopUnswitch/unswitch-select.ll
@@ -1,5 +1,6 @@
; REQUIRES: asserts
; RUN: opt < %s -loop-unswitch -disable-output -stats 2>&1| FileCheck %s
+; RUN: opt < %s -loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -disable-output -stats 2>&1| FileCheck %s
; Check the select statement in the loop will be unswitched.
; CHECK: 1 loop-unswitch - Number of selects unswitched
OpenPOWER on IntegriCloud