[llvm-commits] [llvm] r55031 - in /llvm/trunk: include/llvm/CodeGen/FastISel.h lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Dan Gohman gohman at apple.com
Tue Aug 19 17:56:18 PDT 2008


Author: djg
Date: Tue Aug 19 19:56:17 2008
New Revision: 55031

URL: http://llvm.org/viewvc/llvm-project?rev=55031&view=rev
Log:
Fix a leak in the FastISel code that Chris pointed out.

Modified:
    llvm/trunk/include/llvm/CodeGen/FastISel.h
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Modified: llvm/trunk/include/llvm/CodeGen/FastISel.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/FastISel.h?rev=55031&r1=55030&r2=55031&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/FastISel.h (original)
+++ llvm/trunk/include/llvm/CodeGen/FastISel.h Tue Aug 19 19:56:17 2008
@@ -43,13 +43,13 @@
   SelectInstructions(BasicBlock::iterator Begin, BasicBlock::iterator End,
                      DenseMap<const Value*, unsigned> &ValueMap);
 
+  virtual ~FastISel();
+
 protected:
   FastISel(MachineBasicBlock *mbb, MachineFunction *mf,
            const TargetInstrInfo *tii)
     : MBB(mbb), MF(mf), TII(tii) {}
 
-  virtual ~FastISel();
-
   /// FastEmit_r - This method is called by target-independent code
   /// to request that an instruction with the given type and opcode
   /// be emitted.

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=55031&r1=55030&r2=55031&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Aug 19 19:56:17 2008
@@ -5115,6 +5115,14 @@
     if (FastISel *F = TLI.createFastISel(BB, &FuncInfo.MF,
                                        TLI.getTargetMachine().getInstrInfo())) {
       Begin = F->SelectInstructions(Begin, LLVMBB->end(), FuncInfo.ValueMap);
+
+      // Clean up the FastISel object. TODO: Reorganize what data is
+      // stored in the FastISel class itself and what is merely passed
+      // to the SelectInstructions method, and then move the creation
+      // and deletion of the FastISel object up so that it is only
+      // done once per MachineFunction.
+      delete F;
+
       if (Begin == LLVMBB->end())
         // The "fast" selector selected the entire block, so we're done.
         return;





More information about the llvm-commits mailing list