diff options
author | Pete Cooper <peter_cooper@apple.com> | 2015-06-24 00:05:07 +0000 |
---|---|---|
committer | Pete Cooper <peter_cooper@apple.com> | 2015-06-24 00:05:07 +0000 |
commit | a272f7fca97f5873f26f8d14e5fa2cc328d500d5 (patch) | |
tree | bac226cee3cf5a3ecbecc0ddf99e519160a877e4 /llvm/lib/IR/Globals.cpp | |
parent | 89ae9a1e28c7c8a01f876749272890cd714cda05 (diff) | |
download | bcm5719-llvm-a272f7fca97f5873f26f8d14e5fa2cc328d500d5.tar.gz bcm5719-llvm-a272f7fca97f5873f26f8d14e5fa2cc328d500d5.zip |
Remove unused GlobalVariable::replaceUsesOfWithOnConstant. NFC.
The only caller of this method is Value::replaceAllUsesWith which
explicitly checks that we are not a GlobalValue. So replace the
body with an unreachable to ensure that we never call it.
The unreachable itself is moved to GlobalValue not GlobalVariable
as that is the base class of all the globals we don't want to call
this method on.
Note, this patch is short lived as i'll soon refactor all callers
of this method.
llvm-svn: 240486
Diffstat (limited to 'llvm/lib/IR/Globals.cpp')
-rw-r--r-- | llvm/lib/IR/Globals.cpp | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp index a431b5c6100..49ac236778c 100644 --- a/llvm/lib/IR/Globals.cpp +++ b/llvm/lib/IR/Globals.cpp @@ -48,6 +48,10 @@ void GlobalValue::destroyConstantImpl() { llvm_unreachable("You can't GV->destroyConstantImpl()!"); } +void GlobalValue::replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U) { + llvm_unreachable("You can't GV->replaceUsesOfWithOnConstant()!"); +} + /// copyAttributesFrom - copy all additional attributes (those not needed to /// create a GlobalValue) from the GlobalValue Src to this one. void GlobalValue::copyAttributesFrom(const GlobalValue *Src) { @@ -191,26 +195,6 @@ void GlobalVariable::eraseFromParent() { getParent()->getGlobalList().erase(this); } -void GlobalVariable::replaceUsesOfWithOnConstant(Value *From, Value *To, - Use *U) { - // If you call this, then you better know this GVar has a constant - // initializer worth replacing. Enforce that here. - assert(getNumOperands() == 1 && - "Attempt to replace uses of Constants on a GVar with no initializer"); - - // And, since you know it has an initializer, the From value better be - // the initializer :) - assert(getOperand(0) == From && - "Attempt to replace wrong constant initializer in GVar"); - - // And, you better have a constant for the replacement value - assert(isa<Constant>(To) && - "Attempt to replace GVar initializer with non-constant"); - - // Okay, preconditions out of the way, replace the constant initializer. - this->setOperand(0, cast<Constant>(To)); -} - void GlobalVariable::setInitializer(Constant *InitVal) { if (!InitVal) { if (hasInitializer()) { |