[llvm-commits] PATCH: Fix quadratic behavior in PR12652
Jakob Stoklund Olesen
stoklund at 2pi.dk
Fri Jul 6 17:27:39 PDT 2012
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).
> 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.
/jakob
More information about the llvm-commits
mailing list