Fix a funny bug I introduced during conversion of ARM constant islands to Mips.
[oota-llvm.git] / lib / Target / Mips / MipsConstantIslandPass.cpp
index 63d07f35478b50ef45a11a4fbc0b415fddb05c37..f3a61e84cb766259eeb7de466d50ba6ce07304b8 100644 (file)
@@ -1275,6 +1275,10 @@ bool MipsConstantIslands::handleConstantPoolUser(unsigned CPUserIndex) {
   // Decrement the old entry, and remove it if refcount becomes 0.
   decrementCPEReferenceCount(CPI, CPEMI);
 
+  // No existing clone of this CPE is within range.
+  // We will be generating a new clone.  Get a UID for it.
+  unsigned ID = createPICLabelUId();
+
   // Now that we have an island to add the CPE to, clone the original CPE and
   // add it to the island.
   U.HighWaterMark = NewIsland;
@@ -1290,9 +1294,7 @@ bool MipsConstantIslands::handleConstantPoolUser(unsigned CPUserIndex) {
   BBInfo[NewIsland->getNumber()].Size += Size;
   adjustBBOffsetsAfter(llvm::prior(MachineFunction::iterator(NewIsland)));
 
-  // No existing clone of this CPE is within range.
-  // We will be generating a new clone.  Get a UID for it.
-  unsigned ID = createPICLabelUId();
+
 
   // Finally, change the CPI in the instruction operand to be ID.
   for (unsigned i = 0, e = UserMI->getNumOperands(); i != e; ++i)