[llvm-commits] CVS: reopt/lib/TraceToFunction/TraceToFunction.cpp

Brian Gaeke gaeke at cs.uiuc.edu
Fri Jul 9 14:43:01 PDT 2004


Changes in directory reopt/lib/TraceToFunction:

TraceToFunction.cpp updated: 1.74 -> 1.75

---
Log message:

Key the Return Block for Trace Exit map on return instructions, not the
basic blocks that they happen to be in, because it is possible for the
CFG to change, and it seems to me more likely that a return instruction
would end up in a different basic block than for it to be destroyed and
replaced with a new one.

getFunctionArg is history, having no more users.


---
Diffs of the changes:  (+7 -7)

Index: reopt/lib/TraceToFunction/TraceToFunction.cpp
diff -u reopt/lib/TraceToFunction/TraceToFunction.cpp:1.74 reopt/lib/TraceToFunction/TraceToFunction.cpp:1.75
--- reopt/lib/TraceToFunction/TraceToFunction.cpp:1.74	Thu Jul  8 14:25:06 2004
+++ reopt/lib/TraceToFunction/TraceToFunction.cpp	Fri Jul  9 14:41:27 2004
@@ -716,9 +716,6 @@
         BasicBlock *FB = new BasicBlock (name, F);
         // Remember to change BI's clone's destination to FB.
         newSuccessor = FB;
-        // Remember that FB's "return" instruction would involve a
-        // return to the off-trace successor we just found.
-        TF->ReturnBlockForTraceExit[FB] = successor;
         // Add the getelementptr/store instruction pairs here that
         // correspond to each live-out variable.
         for (LiveVariableVector::iterator SI = So.begin (), SE = So.end ();
@@ -729,9 +726,12 @@
               (new StoreInst (O2CMap[*SI], TF->LiveOutToArgMap[*SI]));
         // Make FB contain a return instruction that returns the
         // number of the taken exit-branch. Add it to the end of FB:
-        FB->getInstList ().push_back
-          (new ReturnInst (ConstantUInt::get (Type::UIntTy,
-                                              BranchNumber[BI])));
+        ReturnInst *RI = new ReturnInst (ConstantUInt::get (Type::UIntTy,
+                                                            BranchNumber[BI]));
+        FB->getInstList ().push_back (RI);
+        // Remember that FB's "return" instruction would involve a
+        // return to the off-trace successor we just found.
+        TF->ReturnBlockForTraceExit[RI] = successor;
       } else {
         // This is a non-trace-exiting destination of branch BI. Fix up
         // its clone's destination to point to its successor's clone.
@@ -744,7 +744,7 @@
         << " of trace-exiting branch instruction:\n" << *BIinF << " from "
         << BIinF->getSuccessor(i)->getName () <<  " to "
         << newSuccessor->getName () << "\n");
-        BIinF->setSuccessor (i, newSuccessor);
+      BIinF->setSuccessor (i, newSuccessor);
     }
   }
 





More information about the llvm-commits mailing list