[llvm-commits] [llvm] r85792 - /llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
Chris Lattner
sabre at nondot.org
Sun Nov 1 22:28:16 PST 2009
Author: lattner
Date: Mon Nov 2 00:28:16 2009
New Revision: 85792
URL: http://llvm.org/viewvc/llvm-project?rev=85792&view=rev
Log:
restore some code I removed in r85788, refactor it into
a shared place instead of duplicating it 4 times.
Modified:
llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=85792&r1=85791&r2=85792&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Mon Nov 2 00:28:16 2009
@@ -386,6 +386,20 @@
if (BBExecutable.count(I.getParent())) // Inst is executable?
visit(I);
}
+
+ /// RemoveFromOverdefinedPHIs - If I has any entries in the
+ /// UsersOfOverdefinedPHIs map for PN, remove them now.
+ void RemoveFromOverdefinedPHIs(Instruction *I, PHINode *PN) {
+ if (UsersOfOverdefinedPHIs.empty()) return;
+ std::multimap<PHINode*, Instruction*>::iterator It, E;
+ tie(It, E) = UsersOfOverdefinedPHIs.equal_range(PN);
+ while (It != E) {
+ if (It->second == I)
+ UsersOfOverdefinedPHIs.erase(It++);
+ else
+ ++It;
+ }
+ }
private:
friend class InstVisitor<SCCPSolver>;
@@ -904,8 +918,8 @@
// added ourselves to the UsersOfOverdefinedPHIs list for the PHIs,
// make sure to clean out any entries that we put there, for
// efficiency.
- UsersOfOverdefinedPHIs.erase(PN1);
- UsersOfOverdefinedPHIs.erase(PN2);
+ RemoveFromOverdefinedPHIs(&I, PN1);
+ RemoveFromOverdefinedPHIs(&I, PN2);
}
markOverdefined(&I);
@@ -986,8 +1000,8 @@
// added ourselves to the UsersOfOverdefinedPHIs list for the PHIs,
// make sure to clean out any entries that we put there, for
// efficiency.
- UsersOfOverdefinedPHIs.erase(PN1);
- UsersOfOverdefinedPHIs.erase(PN2);
+ RemoveFromOverdefinedPHIs(&I, PN1);
+ RemoveFromOverdefinedPHIs(&I, PN2);
}
markOverdefined(&I);
More information about the llvm-commits
mailing list