Replace a bunch of complex ConstantPointerRef referring code with simple
authorChris Lattner <sabre@nondot.org>
Tue, 13 Jul 2004 06:58:07 +0000 (06:58 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 13 Jul 2004 06:58:07 +0000 (06:58 +0000)
code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14785 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AsmParser/llvmAsmParser.y

index b2f901f206e965d788d56044058ea76a16820169..a4d2cf4f9c8858377b886d4df15254c019654f9c 100644 (file)
@@ -118,17 +118,9 @@ static struct PerModuleInfo {
     if (I != GlobalRefs.end()) {
       GlobalValue *OldGV = I->second;   // Get the placeholder...
       I->first.second.destroy();  // Free string memory if necessary
-      
-      // Loop over all of the uses of the GlobalValue.  The only thing they are
-      // allowed to be is ConstantPointerRef's.
-      assert(OldGV->hasOneUse() && "Only one reference should exist!");
-      User *U = OldGV->use_back();  // Must be a ConstantPointerRef...
-      ConstantPointerRef *CPR = cast<ConstantPointerRef>(U);
-        
-      // Change the const pool reference to point to the real global variable
-      // now.  This should drop a use from the OldGV.
-      CPR->replaceUsesOfWithOnConstant(OldGV, GV);
-      assert(OldGV->use_empty() && "All uses should be gone now!");
+
+      // Replace all uses of the placeholder with the new GV
+      OldGV->replaceAllUsesWith(GV); 
       
       // Remove OldGV from the module...
       if (GlobalVariable *GVar = dyn_cast<GlobalVariable>(OldGV))