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
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index b347bad..87524e6 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,
DominatorTree &DT,
- const BasicBlock *BB,
- bool IncludeSelf) {
+ const BasicBlock *BB) {
assert(From->getType() == To->getType());
unsigned Count = 0;
@@ -1688,8 +1687,7 @@
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");