This is an archive of the discontinued LLVM Phabricator instance.

Compute live-in for MemorySSA
ClosedPublic

Authored by dberlin on Feb 6 2016, 2:04 PM.

Details

Summary

While working on some unit tests for an optimization, i discovered some cases where live-in computation eliminations useless phis for MemorySSA.
The calculation is cheap, and we can always disable it later, so enable it for now.

Diff Detail

Event Timeline

dberlin updated this revision to Diff 47099.Feb 6 2016, 2:04 PM
dberlin retitled this revision from to Compute live-in for MemorySSA.
dberlin updated this object.
dberlin added reviewers: reames, hfinkel.
dberlin added inline comments.Feb 6 2016, 2:07 PM
lib/Transforms/Utils/MemorySSA.cpp
264–267

In case the change made here isn't obvious - we used to try to insert the block into the set *for each relevant instruction we found in the block* (IE N attempts per block), and now we only insert it into the set once per block.

dberlin updated this revision to Diff 47101.Feb 6 2016, 2:19 PM
  • Update comment
majnemer accepted this revision.Feb 6 2016, 4:34 PM
majnemer added a reviewer: majnemer.
majnemer added a subscriber: majnemer.

This LGTM. An argument could be made, either for or against, that the change to minimize the number of attempts to update DefiningBlocks could be split out.

lib/Transforms/Utils/MemorySSA.cpp
308–313

Any reason not to use the range-based predecessors?
It should make the code a little shorter:

for (BasicBlock *P : predecessors(BB))
  LiveInBlockWorklist.push_back(P);

I guess you could also use append instead:

LiveInBlockWorklist.append(pred_begin(BB), pred_end(BB));
test/Transforms/Util/MemorySSA/livein.ll
26

Would you mind adding a space between that semicolon and the CHECK to match the others?

This revision is now accepted and ready to land.Feb 6 2016, 4:34 PM

It seems this was committed as r260014. Closing.