mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
bug 122:
- Correct isa<Constant> for GlobalValue subclass llvm-svn: 14933
This commit is contained in:
parent
4005f11ca3
commit
27b74ad249
@ -15,6 +15,7 @@
|
|||||||
#include "llvm/SymbolTable.h"
|
#include "llvm/SymbolTable.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/Constant.h"
|
#include "llvm/Constant.h"
|
||||||
|
#include "llvm/GlobalValue.h"
|
||||||
#include "Support/LeakDetector.h"
|
#include "Support/LeakDetector.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -71,7 +72,10 @@ void Value::uncheckedReplaceAllUsesWith(Value *New) {
|
|||||||
// Must handle Constants specially, we cannot call replaceUsesOfWith on a
|
// Must handle Constants specially, we cannot call replaceUsesOfWith on a
|
||||||
// constant!
|
// constant!
|
||||||
if (Constant *C = dyn_cast<Constant>(U.getUser())) {
|
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 {
|
} else {
|
||||||
U.set(New);
|
U.set(New);
|
||||||
}
|
}
|
||||||
@ -97,7 +101,7 @@ void Value::replaceAllUsesWith(Value *New) {
|
|||||||
void User::replaceUsesOfWith(Value *From, Value *To) {
|
void User::replaceUsesOfWith(Value *From, Value *To) {
|
||||||
if (From == To) return; // Duh what?
|
if (From == To) return; // Duh what?
|
||||||
|
|
||||||
assert(!isa<Constant>(this) &&
|
assert(!isa<Constant>(this) || isa<GlobalValue>(this) &&
|
||||||
"Cannot call User::replaceUsesofWith on a constant!");
|
"Cannot call User::replaceUsesofWith on a constant!");
|
||||||
|
|
||||||
for (unsigned i = 0, E = getNumOperands(); i != E; ++i)
|
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...
|
setOperand(i, To); // Fix it now...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user