[llvm] r280949 - revert r280427
Dehao Chen via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 8 08:25:12 PDT 2016
Author: dehao
Date: Thu Sep 8 10:25:12 2016
New Revision: 280949
URL: http://llvm.org/viewvc/llvm-project?rev=280949&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/Transforms/Utils/Local.h
llvm/trunk/lib/Transforms/Scalar/GVN.cpp
llvm/trunk/lib/Transforms/Utils/Local.cpp
Modified: llvm/trunk/include/llvm/Transforms/Utils/Local.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/Local.h?rev=280949&r1=280948&r2=280949&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/Local.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/Local.h Thu Sep 8 10:25:12 2016
@@ -326,12 +326,10 @@ void combineMetadataForCSE(Instruction *
/// the given edge. Returns the number of replacements made.
unsigned replaceDominatedUsesWith(Value *From, Value *To, DominatorTree &DT,
const BasicBlockEdge &Edge);
-
/// Replace each use of 'From' with 'To' if that use is dominated by
-/// the end of 'BB'. Returns the number of replacements made.
-/// Replace use of 'From' with 'To' in 'BB' if 'IncludeSelf' is true.
+/// the end of the given BasicBlock. Returns the number of replacements made.
unsigned replaceDominatedUsesWith(Value *From, Value *To, DominatorTree &DT,
- const BasicBlock *BB, bool IncludeSelf);
+ const BasicBlock *BB);
/// Return true if the CallSite CS calls a gc leaf function.
Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=280949&r1=280948&r2=280949&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Thu Sep 8 10:25:12 2016
@@ -1962,7 +1962,7 @@ bool GVN::propagateEquality(Value *LHS,
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,
DominatesByEdge
? replaceDominatedUsesWith(NotCmp, NotVal, *DT, Root)
: replaceDominatedUsesWith(NotCmp, NotVal, *DT,
- Root.getStart(), false);
+ Root.getStart());
Changed |= NumReplacements > 0;
NumGVNEqProp += NumReplacements;
}
Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=280949&r1=280948&r2=280949&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/Local.cpp Thu Sep 8 10:25:12 2016
@@ -1679,8 +1679,7 @@ unsigned llvm::replaceDominatedUsesWith(
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(
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");
More information about the llvm-commits
mailing list