Eliminate nightmarish API
authorChris Lattner <sabre@nondot.org>
Mon, 8 Mar 2004 06:11:10 +0000 (06:11 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 8 Mar 2004 06:11:10 +0000 (06:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12214 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Constants.cpp

index 5a617fad9ae517de582aa82a4f5f23d4d40e9b51..0762725c288c8ff84d474f26e8d6a84d27c4e743 100644 (file)
@@ -1119,26 +1119,3 @@ void ConstantExpr::destroyConstant() {
 const char *ConstantExpr::getOpcodeName() const {
   return Instruction::getOpcodeName(getOpcode());
 }
-
-unsigned Constant::mutateReferences(Value *OldV, Value *NewV) {
-  // Uses of constant pointer refs are global values, not constants!
-  if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(this)) {
-    GlobalValue *NewGV = cast<GlobalValue>(NewV);
-    GlobalValue *OldGV = CPR->getValue();
-
-    assert(OldGV == OldV && "Cannot mutate old value if I'm not using it!");
-    Operands[0] = NewGV;
-    OldGV->getParent()->mutateConstantPointerRef(OldGV, NewGV);
-    return 1;
-  } else {
-    Constant *NewC = cast<Constant>(NewV);
-    unsigned NumReplaced = 0;
-    for (unsigned i = 0, N = getNumOperands(); i != N; ++i)
-      if (Operands[i] == OldV) {
-        ++NumReplaced;
-        Operands[i] = NewC;
-      }
-    return NumReplaced;
-  }
-}
-