This is an archive of the discontinued LLVM Phabricator instance.

Rip min/max pattern matching out of InstCombine and into ValueTracking.
ClosedPublic

Authored by jmolloy on Apr 27 2015, 8:18 AM.

Details

Summary

Rip min/max pattern matching out of InstCombine and into ValueTracking.

This matching functionality is useful in more than just InstCombine, so
make it available in ValueTracking.

NFC.

Diff Detail

Repository
rL LLVM

Event Timeline

jmolloy updated this revision to Diff 24478.Apr 27 2015, 8:18 AM
jmolloy retitled this revision from to Rip min/max pattern matching out of InstCombine and into ValueTracking. .
jmolloy updated this object.
jmolloy edited the test plan for this revision. (Show Details)
jmolloy added reviewers: Gerolf, hfinkel, reames.
jmolloy set the repository for this revision to rL LLVM.
jmolloy added a subscriber: Unknown Object (MLST).

Could the PatternMatch version of min/max idiom detection be recast in terms of this machinery? http://llvm.org/docs/doxygen/html/PatternMatch_8h_source.html#l00946

reames accepted this revision.Apr 27 2015, 9:25 AM
reames edited edge metadata.

LGTM. If you want to reframe things w/PatternMatch, feel free, but please do that in a second commit. Having the move be clearly NFC is worthwhile.

include/llvm/Analysis/ValueTracking.h
232

There's no reason this has to be restricted to select. Given that, I'd remove it from the comment & naming.

p.s. w.r.t the term "pattern": Personally, I might have used "idiom", but I'm not sure the difference matters.

(edit - given you're just moving the naming from instcombine, please ignore the previous and do not change.)

lib/Analysis/ValueTracking.cpp
3047

Stale comment?

3059

You could likely combine this with the above by canonicalizing the predicate and operand direction. I'm fine with the code as is, just pointing that out.

This revision is now accepted and ready to land.Apr 27 2015, 9:25 AM
Gerolf added inline comments.Apr 27 2015, 11:41 AM
lib/Analysis/ValueTracking.cpp
3078

what about >= 0?

Hi, I've landed this in r236998, but am keeping this defect open for now because of Gerolf's comment.

jmolloy closed this revision.Jul 17 2015, 2:21 AM