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

Chandler Carruth chandlerc at gmail.com
Sun Jul 8 03:54:27 PDT 2012


On Fri, Jul 6, 2012 at 5:27 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk>wrote:

>
> On Jul 6, 2012, at 5:02 PM, Chandler Carruth <chandlerc at gmail.com> wrote:
>
> > This isn't nearly finished, and its still missing both some cleanups I
> suspect and it has a few bugs that I haven't had time to track down, but
> wanted to see if this is more along the lines you were thinking of
> algorithm-wise. New patch attached.
>
> I missed this the first time:
>
> +  if (empty()) {
> +    for (const_iterator RI = RHS.begin(), RE = RHS.end(); RI != RE; ++RI)
> +      if (!RHSValNo || RI->valno == RHSValNo) {
> +        ranges.push_back(*RI);
> +        ranges.back().valno = LHSValNo;
> +      }
> +    return;
> +  }
>
> If RHS has segments that are touching (ranges[i].end ==
> ranges[i+1].start), but have different values, they would need to be merged
> here because now they all have the same value: LHSValNo. (This is where
> verify() would come in handy).
>

Yea there were a few bugs like this. That's why I had the big caveat,
hadn't finished testing it.


> > If (algorithmically) you're liking this direction, then after cleaning
> up, fixing bugs, and testing performance in both cases, is this a good
> initial step to commit?
>
> Yes, but you definitely need to run a test where you verify invariants.


OK, it now passes with the verification I mailed out layered on top to
assert everywhere. Passes both regtests and a bootstrap.

I also measured the 'llc' time for a few big bitcode files from "normal"
code (117.mesa LTO-ed, sqlite3, and a single-source-file version of Clang's
lexer / preprocessor library). I saw no measurable performance change.

Updated patch attached.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120708/a88986d3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr12652.patch
Type: application/octet-stream
Size: 7715 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120708/a88986d3/attachment.obj>


More information about the llvm-commits mailing list