This loop executed exactly one time, turn it into straightline code
authorChris Lattner <sabre@nondot.org>
Mon, 14 Oct 2002 03:28:42 +0000 (03:28 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 14 Oct 2002 03:28:42 +0000 (03:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4159 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AsmParser/llvmAsmParser.y

index 52ef6907f29831cd5dc6656494186e23f31b4104..71da575080a060dfa8440dad4be42c260f46d8d7 100644 (file)
@@ -117,15 +117,13 @@ static struct PerModuleInfo {
       // 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);