[llvm-commits] CVS: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp ValueAllocState.cpp

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


Changes in directory reopt/lib/LightWtProfiling:

UnpackTraceFunction.cpp updated: 1.92 -> 1.93
ValueAllocState.cpp updated: 1.5 -> 1.6

---
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:  (+10 -8)

Index: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp
diff -u reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.92 reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.93
--- reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.92	Thu Jul  8 02:43:11 2004
+++ reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp	Fri Jul  9 14:41:27 2004
@@ -22,6 +22,7 @@
 #include "llvm/Support/CFG.h"
 #include "llvm/Module.h"
 #include "llvm/iPHINode.h"
+#include "llvm/iTerminators.h"
 #include "llvm/Assembly/Writer.h"
 #include "Support/StringExtras.h"                   // for utostr()
 #include "Support/Debug.h"
@@ -407,10 +408,11 @@
   MBB.clear ();
   
   // Find the BasicBlock in MatrixFn that this block's return instr.
-  // would have returned to, by consulting our mapping information.
-  // FIXME: Currently we key our mapping info on TraceFn basic blocks.
-  // This is fragile - we should use ReturnInsts instead, I think.
-  const BasicBlock *RBB = TF->ReturnBlockForTraceExit[MBB.getBasicBlock ()];
+  // would have returned to, by consulting the mapping information
+  // generated by TraceFunctionBuilder.
+  const ReturnInst *RI =
+    cast<ReturnInst> (MBB.getBasicBlock ()->getTerminator ());
+  const BasicBlock *RBB = TF->ReturnBlockForTraceExit[RI];
   assert (RBB && "Can't find matrix fn BB address to return to from trace");
   DEBUG (std::cerr << "rewriteEpilog: Return block for trace exit path is:\n"
          << *RBB << "\n");
@@ -538,8 +540,8 @@
   // that are known to the SparcV9 backend.
   StaticStackSize = getStaticStackSize (MF);
   TotalStackSize = (StaticStackSize + 176 + 104 * 8);
-  DEBUG(std::cerr << "rewriteProlog: Stack sizes: static = " << StaticStackSize
-        << ", total = " << TotalStackSize << "\n");
+  DEBUG(std::cerr << "UnpackTraceFunction: Stack sizes: static = "
+        << StaticStackSize << ", total = " << TotalStackSize << "\n");
 
   // Rewrite function prolog, found in the entry MachineBasicBlock of MF
   rewriteProlog (MF, MF.front ());
@@ -547,7 +549,7 @@
   // Rewrite function epilogs, found in every exit MachineBasicBlock of MF
   for (MachineFunction::iterator I = MF.begin (), E = MF.end (); I != E; ++I) {
     MachineBasicBlock &MBB = *I;
-    if (const MachineInstr *RI = containsReturnInstr (MBB))
+    if (containsReturnInstr (MBB))
       rewriteEpilog (MF, MBB);
   }
 


Index: reopt/lib/LightWtProfiling/ValueAllocState.cpp
diff -u reopt/lib/LightWtProfiling/ValueAllocState.cpp:1.5 reopt/lib/LightWtProfiling/ValueAllocState.cpp:1.6
--- reopt/lib/LightWtProfiling/ValueAllocState.cpp:1.5	Thu Jul  8 02:43:11 2004
+++ reopt/lib/LightWtProfiling/ValueAllocState.cpp	Fri Jul  9 14:41:27 2004
@@ -91,7 +91,7 @@
 static void findTraceBoundaryBlocks (TraceFunction *TF) {
   TraceBoundaryBlocks.clear ();
   TraceBoundaryBlocks.insert (TF->T.getEntryBasicBlock ());
-  for (BasicBlockMap::iterator i = TF->ReturnBlockForTraceExit.begin (),
+  for (ReturnBlockMap::iterator i = TF->ReturnBlockForTraceExit.begin (),
        e = TF->ReturnBlockForTraceExit.end (); i != e; ++i) {
     TraceBoundaryBlocks.insert (i->second);
   }





More information about the llvm-commits mailing list