[PATCH] Speed up creation of live ranges for physical registers by using a segment set

Quentin Colombet qcolombet at apple.com
Tue Nov 4 10:08:44 PST 2014


================
Comment at: lib/CodeGen/LiveInterval.cpp:622
@@ +621,3 @@
+VNInfo *LiveRange::segsetCreateDeadDef(SlotIndex Def,
+                                  VNInfo::Allocator &VNInfoAllocator) {
+  assert(!Def.isDead() && "Cannot define a value at the dead slot");
----------------
gasiunas wrote:
> qcolombet wrote:
> > Please try to share this code between the vector and the set versions.
> > You could stick to the existing implementation (with some abstract on the iterator type) and use an abstraction for the final insertion for instance.
> I don't see how it would work. Could you give some more details? Do you suggest having some adapter iterator wrapping one of the two iterators? 
Yes something like that, or you can use a template argument for the iterator type. Though that can be messy quite quickly.

================
Comment at: lib/CodeGen/LiveInterval.cpp:656
@@ +655,3 @@
+
+  if (segmentSet->empty()) {
+    return nullptr;
----------------
gasiunas wrote:
> qcolombet wrote:
> > Same thing as segsetCreateDeadDef, you should share more logic between the implementations.
> > For instance, you could abstract begin(), upper_bound(), empty() and you should be able to reuse all the code.
> How can I abstract them, if the two iterator types are not compatible with each other? 
A new type on top of them, like you suggested ;).

================
Comment at: lib/CodeGen/LiveInterval.cpp:948
@@ +947,3 @@
+  if (LR->segmentSet != NULL) {
+    LR->addSegment(Seg);
+    return;
----------------
gasiunas wrote:
> qcolombet wrote:
> > Is this code path used during createDeadDefs and extendToUses?
> It is used in LiveRangeCalc::extendToUses through LiveRangeCalc::findReachingDefs
Ah right! Thanks.

http://reviews.llvm.org/D6013






More information about the llvm-commits mailing list