[llvm-commits] PATCH: Fix quadratic behavior in PR12652

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Jul 6 15:51:28 PDT 2012


On Jul 6, 2012, at 3:40 PM, Chandler Carruth <chandlerc at gmail.com> wrote:

> I still think we should likely make join() use this code because we should make it handle that input pattern efficiently, but fall back on something that isn't super-linear when it hits edge cases.

How about sticking the merge state in a (local) class:

class LIMerger {
  NewRanges, …
public:
  LIMerger(LiveInterval &LHS, SlotIndex StartPos);
  void add(SlotIndex From, SlotIndex To, VNInfo *VNI);
  void finish();
};

That interface could readily be used by all three clients, and you don't clutter up the code with value mapping stuff.

The add method can require disjoint, increasing segments:

void add(…) {
  assert(From >= StartPos);
  StartPos = To;
…
}

/jakob

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120706/0fd42a0a/attachment.html>


More information about the llvm-commits mailing list