summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2013-01-05 05:05:51 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2013-01-05 05:05:51 +0000
commitdc5285f102b70c38f156af4dd41db6eaf8992c32 (patch)
tree09c1a98504a9ce017af4d6fb88b639704026d8dc /llvm/lib/CodeGen/MachineInstr.cpp
parent1bfeecb491060af8fb0a69451f10cd535e2d2e1c (diff)
downloadbcm5719-llvm-dc5285f102b70c38f156af4dd41db6eaf8992c32.tar.gz
bcm5719-llvm-dc5285f102b70c38f156af4dd41db6eaf8992c32.zip
Don't call destructors on MachineInstr and MachineOperand.
The series of patches leading up to this one makes llc -O0 run 8% faster. When deallocating a MachineFunction, there is no need to visit all MachineInstr and MachineOperand objects to deallocate them. All their memory come from a BumpPtrAllocator that is about to be purged, and they have empty destructors anyway. This only applies when deallocating the MachineFunction. DeleteMachineInstr() should still be used to recycle MI memory during the codegen passes. Remove the LeakDetector support for MachineInstr. I've never seen it used before, and now it definitely doesn't work. With this patch, leaked MachineInstrs would be much less of a problem since all of their memory will be reclaimed by ~MachineFunction(). llvm-svn: 171599
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineInstr.cpp21
1 files changed, 1 insertions, 20 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index d3342987c05..3255fa6e451 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -35,7 +35,6 @@
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/LeakDetector.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetInstrInfo.h"
@@ -544,8 +543,6 @@ MachineInstr::MachineInstr(MachineFunction &MF, const MCInstrDesc &tid,
if (!NoImp)
addImplicitDefUseOperands(MF);
- // Make sure that we get added to a machine basicblock
- LeakDetector::addGarbageObject(this);
}
/// MachineInstr ctor - Copies MachineInstr arg exactly
@@ -558,28 +555,12 @@ MachineInstr::MachineInstr(MachineFunction &MF, const MachineInstr &MI)
CapOperands = OperandCapacity::get(MI.getNumOperands());
Operands = MF.allocateOperandArray(CapOperands);
- // Add operands
+ // Copy operands.
for (unsigned i = 0; i != MI.getNumOperands(); ++i)
addOperand(MF, MI.getOperand(i));
// Copy all the sensible flags.
setFlags(MI.Flags);
-
- // Set parent to null.
- Parent = 0;
-
- LeakDetector::addGarbageObject(this);
-}
-
-MachineInstr::~MachineInstr() {
- LeakDetector::removeGarbageObject(this);
-#ifndef NDEBUG
- for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
- assert(Operands[i].ParentMI == this && "ParentMI mismatch!");
- assert((!Operands[i].isReg() || !Operands[i].isOnRegUseList()) &&
- "Reg operand def/use list corrupted");
- }
-#endif
}
/// getRegInfo - If this instruction is embedded into a MachineFunction,
OpenPOWER on IntegriCloud