[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y

Chris Lattner lattner at cs.uiuc.edu
Mon Jul 12 23:58:17 PDT 2004



Changes in directory llvm/lib/AsmParser:

llvmAsmParser.y updated: 1.172 -> 1.173

---
Log message:

Replace a bunch of complex ConstantPointerRef referring code with simple
code.


---
Diffs of the changes:  (+3 -11)

Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.172 llvm/lib/AsmParser/llvmAsmParser.y:1.173
--- llvm/lib/AsmParser/llvmAsmParser.y:1.172	Fri Jul  9 11:43:55 2004
+++ llvm/lib/AsmParser/llvmAsmParser.y	Tue Jul 13 01:58:07 2004
@@ -118,17 +118,9 @@
     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))





More information about the llvm-commits mailing list