diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-07-18 00:01:50 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-07-18 00:01:50 +0000 |
commit | 4ec2e4c57896fa6e301f5f5a02669287c3116393 (patch) | |
tree | 58f7d852e3e85d49a0be6db2b3e3693ba9f471a3 /lib/VMCore | |
parent | ffe77d36eb50f5236cb31e2f5b51e00d475e29f9 (diff) | |
download | external_llvm-4ec2e4c57896fa6e301f5f5a02669287c3116393.zip external_llvm-4ec2e4c57896fa6e301f5f5a02669287c3116393.tar.gz external_llvm-4ec2e4c57896fa6e301f5f5a02669287c3116393.tar.bz2 |
bug 122:
- Correct isa<Constant> for GlobalValue subclass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14933 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/Value.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp index a4f2669..d14d165 100644 --- a/lib/VMCore/Value.cpp +++ b/lib/VMCore/Value.cpp @@ -15,6 +15,7 @@ #include "llvm/SymbolTable.h" #include "llvm/DerivedTypes.h" #include "llvm/Constant.h" +#include "llvm/GlobalValue.h" #include "Support/LeakDetector.h" #include <algorithm> #include <iostream> @@ -71,7 +72,10 @@ void Value::uncheckedReplaceAllUsesWith(Value *New) { // Must handle Constants specially, we cannot call replaceUsesOfWith on a // constant! if (Constant *C = dyn_cast<Constant>(U.getUser())) { - C->replaceUsesOfWithOnConstant(this, New, true); + if (!isa<GlobalValue>(C)) + C->replaceUsesOfWithOnConstant(this, New, true); + else + U.set(New); } else { U.set(New); } @@ -97,7 +101,7 @@ void Value::replaceAllUsesWith(Value *New) { void User::replaceUsesOfWith(Value *From, Value *To) { if (From == To) return; // Duh what? - assert(!isa<Constant>(this) && + assert(!isa<Constant>(this) || isa<GlobalValue>(this) && "Cannot call User::replaceUsesofWith on a constant!"); for (unsigned i = 0, E = getNumOperands(); i != E; ++i) @@ -108,3 +112,4 @@ void User::replaceUsesOfWith(Value *From, Value *To) { setOperand(i, To); // Fix it now... } } + |