This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Fold umin_seq to umin using implied poison reasoning
ClosedPublic

Authored by nikic on May 4 2022, 6:11 AM.

Details

Summary

Similar to how we convert logical and/or to bitwise and/or, we should also convert umin_seq to umin based on implied poison reasoning. In %x umin_seq %y, if %y being poison implies %x being poison, then we don't need the sequential evaluation: Having %y contribute towards the result will never make the result more poisonous. An important corollary of this is that if %y is never poison, we also don't need the sequential evaluation.

This avoids some of the regressions in D124910.

Diff Detail

Event Timeline

nikic created this revision.May 4 2022, 6:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2022, 6:11 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
nikic requested review of this revision.May 4 2022, 6:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2022, 6:11 AM
nikic updated this revision to Diff 426984.May 4 2022, 6:26 AM

Simplify implementation

reames accepted this revision.May 4 2022, 7:50 AM

LGTM w/minor comments

llvm/lib/Analysis/ScalarEvolution.cpp
4042

Can you add a small comment reminding the reader that constantexprs are not SCEVConstants? Save the next person the quick search to confirm. :)

4052

Can you add the early return here for when PCI.MayBePoison is empty? Might as well avoid walking the second SCEV.

Also gives you a good place to put for your comment about the corollary.

This revision is now accepted and ready to land.May 4 2022, 7:50 AM
This revision was automatically updated to reflect the committed changes.