summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2016-09-08 15:25:12 +0000
committerDehao Chen <dehao@google.com>2016-09-08 15:25:12 +0000
commitdb3810771e5220b9078e1dbcdce4d2a030eea3ae (patch)
tree6693cb6eab9df4387d7b4d268875dfc72f26572f /llvm/lib/Transforms
parent7886bd7ca5912757f3cb67b55c48939198988f7c (diff)
downloadbcm5719-llvm-db3810771e5220b9078e1dbcdce4d2a030eea3ae.tar.gz
bcm5719-llvm-db3810771e5220b9078e1dbcdce4d2a030eea3ae.zip
revert r280427
Refactor replaceDominatedUsesWith to have a flag to control whether to replace uses in BB itself. Summary: This is in preparation for LoopSink pass which calls replaceDominatedUsesWith to update after sinking. llvm-svn: 280949
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/GVN.cpp4
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp6
2 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index aaec475a682..a108ce8d292 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -1962,7 +1962,7 @@ bool GVN::propagateEquality(Value *LHS, Value *RHS, const BasicBlockEdge &Root,
unsigned NumReplacements =
DominatesByEdge
? replaceDominatedUsesWith(LHS, RHS, *DT, Root)
- : replaceDominatedUsesWith(LHS, RHS, *DT, Root.getStart(), false);
+ : replaceDominatedUsesWith(LHS, RHS, *DT, Root.getStart());
Changed |= NumReplacements > 0;
NumGVNEqProp += NumReplacements;
@@ -2038,7 +2038,7 @@ bool GVN::propagateEquality(Value *LHS, Value *RHS, const BasicBlockEdge &Root,
DominatesByEdge
? replaceDominatedUsesWith(NotCmp, NotVal, *DT, Root)
: replaceDominatedUsesWith(NotCmp, NotVal, *DT,
- Root.getStart(), false);
+ Root.getStart());
Changed |= NumReplacements > 0;
NumGVNEqProp += NumReplacements;
}
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index b347bad9958..87524e660f0 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -1679,8 +1679,7 @@ unsigned llvm::replaceDominatedUsesWith(Value *From, Value *To,
unsigned llvm::replaceDominatedUsesWith(Value *From, Value *To,
DominatorTree &DT,
- const BasicBlock *BB,
- bool IncludeSelf) {
+ const BasicBlock *BB) {
assert(From->getType() == To->getType());
unsigned Count = 0;
@@ -1688,8 +1687,7 @@ unsigned llvm::replaceDominatedUsesWith(Value *From, Value *To,
UI != UE;) {
Use &U = *UI++;
auto *I = cast<Instruction>(U.getUser());
- if ((IncludeSelf && BB == I->getParent()) ||
- DT.properlyDominates(BB, I->getParent())) {
+ if (DT.properlyDominates(BB, I->getParent())) {
U.set(To);
DEBUG(dbgs() << "Replace dominated use of '" << From->getName() << "' as "
<< *To << " in " << *U << "\n");
OpenPOWER on IntegriCloud