Fix a leak in the FastISel code that Chris pointed out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55031 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 6a626b9..1536a64 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -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;