[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGCSEMap.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Aug 11 16:56:10 PDT 2006
Changes in directory llvm/lib/CodeGen/SelectionDAG:
SelectionDAGCSEMap.cpp updated: 1.3 -> 1.4
---
Log message:
Switch NodeID to track 32-bit chunks instead of 8-bit chunks, for a 2.5%
speedup in isel time.
---
Diffs of the changes: (+9 -15)
SelectionDAGCSEMap.cpp | 24 +++++++++---------------
1 files changed, 9 insertions(+), 15 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGCSEMap.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGCSEMap.cpp:1.3 llvm/lib/CodeGen/SelectionDAG/SelectionDAGCSEMap.cpp:1.4
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGCSEMap.cpp:1.3 Fri Aug 11 16:55:30 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGCSEMap.cpp Fri Aug 11 18:55:53 2006
@@ -105,21 +105,15 @@
// on the host. It doesn't matter however, because hashing on pointer values
// in inherently unstable. Nothing in the SelectionDAG should depend on the
// ordering of nodes in the CSEMap.
- union {
- intptr_t PtrI;
- unsigned char PtrA[sizeof(intptr_t)];
- };
- PtrI = (intptr_t)Ptr;
- Bits.append(PtrA, PtrA+sizeof(intptr_t));
+ intptr_t PtrI = (intptr_t)Ptr;
+ Bits.push_back(unsigned(PtrI));
+ if (sizeof(intptr_t) > sizeof(unsigned))
+ Bits.push_back(unsigned(uint64_t(PtrI) >> 32));
}
void SelectionDAGCSEMap::NodeID::AddOperand(SDOperand Op) {
AddPointer(Op.Val);
- // 2 bytes of resno might be too small, three should certainly be enough. :)
- assert(Op.ResNo < (1 << 24) && "ResNo too large for CSE Map to handle!");
- Bits.push_back((Op.ResNo >> 0) & 0xFF);
- Bits.push_back((Op.ResNo >> 8) & 0xFF);
- Bits.push_back((Op.ResNo >> 16) & 0xFF);
+ Bits.push_back(Op.ResNo);
}
void SelectionDAGCSEMap::NodeID::SetOperands(const SDOperand *Ops,
@@ -135,13 +129,13 @@
// FIXME: this hash function sucks.
unsigned Hash = 0;
for (unsigned i = 0, e = Bits.size(); i != e; ++i)
- Hash += Bits[i];
+ Hash = Hash+Bits[i];
return Hash;
}
bool SelectionDAGCSEMap::NodeID::operator==(const NodeID &RHS) const {
if (Bits.size() != RHS.Bits.size()) return false;
- return memcmp(&Bits[0], &RHS.Bits[0], Bits.size()) == 0;
+ return memcmp(&Bits[0], &RHS.Bits[0], Bits.size()*sizeof(Bits[0])) == 0;
}
@@ -169,8 +163,8 @@
}
void **SelectionDAGCSEMap::GetBucketPtr(void *NextInBucketPtr) {
- assert(NextInBucketPtr >= Buckets && NextInBucketPtr < Buckets+NumBuckets &&
- "NextInBucketPtr is not a bucket ptr");
+ //assert(NextInBucketPtr >= Buckets && NextInBucketPtr < Buckets+NumBuckets &&
+ // "NextInBucketPtr is not a bucket ptr");
return static_cast<void**>(NextInBucketPtr);
}
More information about the llvm-commits
mailing list