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

Chris Lattner lattner at cs.uiuc.edu
Sun Oct 13 22:29:01 PDT 2002


Changes in directory llvm/lib/AsmParser:

llvmAsmParser.y updated: 1.96 -> 1.97

---
Log message:

This loop executed exactly one time, turn it into straightline code


---
Diffs of the changes:

Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.96 llvm/lib/AsmParser/llvmAsmParser.y:1.97
--- llvm/lib/AsmParser/llvmAsmParser.y:1.96	Sun Oct 13 15:53:08 2002
+++ llvm/lib/AsmParser/llvmAsmParser.y	Sun Oct 13 22:28:42 2002
@@ -117,15 +117,13 @@
       // Loop over all of the uses of the GlobalValue.  The only thing they are
       // allowed to be is ConstantPointerRef's.
       assert(OldGV->use_size() == 1 && "Only one reference should exist!");
-      while (!OldGV->use_empty()) {
-        User *U = OldGV->use_back();  // Must be a ConstantPointerRef...
-        ConstantPointerRef *CPR = cast<ConstantPointerRef>(U);
-        assert(CPR->getValue() == OldGV && "Something isn't happy");
+      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->mutateReferences(OldGV, GV);
-      }
+      // Change the const pool reference to point to the real global variable
+      // now.  This should drop a use from the OldGV.
+      CPR->mutateReferences(OldGV, GV);
+      assert(OldGV->use_empty() && "All uses should be gone now!");
       
       // Remove OldGV from the module...
       CurrentModule->getGlobalList().remove(OldGV);





More information about the llvm-commits mailing list