Don't store COPY pointers in VNInfo.

If a value is defined by a COPY, that instuction can easily and cheaply
be found by getInstructionFromIndex(VNI->def).

This reduces the size of VNInfo from 24 to 16 bytes, and improves
llc compile time by 3%.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149763 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen
2012-02-04 05:20:49 +00:00
parent edc8db87dc
commit 3b1088a2cc
9 changed files with 52 additions and 119 deletions

View File

@@ -48,7 +48,6 @@ namespace llvm {
IS_UNUSED = 1 << 3
};
MachineInstr *copy;
unsigned char flags;
public:
@@ -61,19 +60,18 @@ namespace llvm {
SlotIndex def;
/// VNInfo constructor.
VNInfo(unsigned i, SlotIndex d, MachineInstr *c)
: copy(c), flags(0), id(i), def(d)
VNInfo(unsigned i, SlotIndex d)
: flags(0), id(i), def(d)
{ }
/// VNInfo construtor, copies values from orig, except for the value number.
VNInfo(unsigned i, const VNInfo &orig)
: copy(orig.copy), flags(orig.flags), id(i), def(orig.def)
: flags(orig.flags), id(i), def(orig.def)
{ }
/// Copy from the parameter into this VNInfo.
void copyFrom(VNInfo &src) {
flags = src.flags;
copy = src.copy;
def = src.def;
}
@@ -86,19 +84,6 @@ namespace llvm {
flags = (flags | VNI->flags) & ~IS_UNUSED;
}
/// For a register interval, if this VN was definied by a copy instr
/// getCopy() returns a pointer to it, otherwise returns 0.
/// For a stack interval the behaviour of this method is undefined.
MachineInstr* getCopy() const { return copy; }
/// For a register interval, set the copy member.
/// This method should not be called on stack intervals as it may lead to
/// undefined behavior.
void setCopy(MachineInstr *c) { copy = c; }
/// isDefByCopy - Return true when this value was defined by a copy-like
/// instruction as determined by MachineInstr::isCopyLike.
bool isDefByCopy() const { return copy != 0; }
/// Returns true if one or more kills are PHI nodes.
/// Obsolete, do not use!
bool hasPHIKill() const { return flags & HAS_PHI_KILL; }
@@ -294,10 +279,9 @@ namespace llvm {
/// getNextValue - Create a new value number and return it. MIIdx specifies
/// the instruction that defines the value number.
VNInfo *getNextValue(SlotIndex def, MachineInstr *CopyMI,
VNInfo::Allocator &VNInfoAllocator) {
VNInfo *getNextValue(SlotIndex def, VNInfo::Allocator &VNInfoAllocator) {
VNInfo *VNI =
new (VNInfoAllocator) VNInfo((unsigned)valnos.size(), def, CopyMI);
new (VNInfoAllocator) VNInfo((unsigned)valnos.size(), def);
valnos.push_back(VNI);
return VNI;
}

View File

@@ -298,8 +298,7 @@ namespace llvm {
void handlePhysicalRegisterDef(MachineBasicBlock* mbb,
MachineBasicBlock::iterator mi,
SlotIndex MIIdx, MachineOperand& MO,
LiveInterval &interval,
MachineInstr *CopyMI);
LiveInterval &interval);
/// handleLiveInRegister - Create interval for a livein register.
void handleLiveInRegister(MachineBasicBlock* mbb,