[llvm-commits] [llvm] r55127 - /llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
Chris Lattner
sabre at nondot.org
Thu Aug 21 10:31:46 PDT 2008
Author: lattner
Date: Thu Aug 21 12:31:45 2008
New Revision: 55127
URL: http://llvm.org/viewvc/llvm-project?rev=55127&view=rev
Log:
Switch from an O(n) method to an O(1) method for changing non-constant
operands.
Modified:
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=55127&r1=55126&r2=55127&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Thu Aug 21 12:31:45 2008
@@ -237,17 +237,18 @@
// new value. If they reference more than one placeholder, update them all
// at once.
while (!Placeholder->use_empty()) {
- User *U = Placeholder->use_back();
+ Value::use_iterator UI = Placeholder->use_begin();
+
// If the using object isn't uniqued, just update the operands. This
// handles instructions and initializers for global variables.
- if (!isa<Constant>(U) || isa<GlobalValue>(U)) {
- U->replaceUsesOfWith(Placeholder, RealVal);
+ if (!isa<Constant>(*UI) || isa<GlobalValue>(*UI)) {
+ UI.getUse().set(RealVal);
continue;
}
// Otherwise, we have a constant that uses the placeholder. Replace that
// constant with a new constant that has *all* placeholder uses updated.
- Constant *UserC = cast<Constant>(U);
+ Constant *UserC = cast<Constant>(*UI);
for (User::op_iterator I = UserC->op_begin(), E = UserC->op_end();
I != E; ++I) {
Value *NewOp;
More information about the llvm-commits
mailing list