This is an archive of the discontinued LLVM Phabricator instance.

[IR][PatternMatch] Introduce m_NegatedPower2() matcher
ClosedPublic

Authored by lebedev.ri on Jul 1 2019, 2:30 PM.

Details

Summary

It is a good idea to do as much matching inside of match() as possible.
If some checking is done afterwards, and we don't fold because of it,
chances are we may have missed some commutative pattern.

Diff Detail

Repository
rL LLVM

Event Timeline

Do we have an upcoming/existing use case for this?

unittests/IR/PatternMatch.cpp
112 ↗(On Diff #207411)

Maybe test a INT_MIN style value? That should return true for both?

lebedev.ri marked an inline comment as done.Jul 2 2019, 2:42 AM

Do we have an upcoming/existing use case for this?

Likewise, this is needed in a followup patch.

unittests/IR/PatternMatch.cpp
112 ↗(On Diff #207411)

Will do.

reverse ping?

reverse ping?

I'm not doing anything here because i don't need this before i post the patch that actually uses this,
and i'm not posting that patch until i can post all of it's prerequisite patches, because otherwise
i will have one more patch up for review, thus increasing review queue even further, and lately
that queue seems to be rather completely stale.

lebedev.ri marked an inline comment as done.

Rebased, added INT_MIN test.

Rebased, added INT_MIN test.

Any other tests wanted?

spatel added inline comments.Jul 25 2019, 4:03 AM
llvm/unittests/IR/PatternMatch.cpp
485 ↗(On Diff #209730)

Why is CNegIntMin negating C128 rather than CIntMin?

lebedev.ri marked 2 inline comments as done.

Fix test with signbit (:

RKSimon accepted this revision.Jul 25 2019, 6:01 AM

LGTM

This revision is now accepted and ready to land.Jul 25 2019, 6:01 AM
spatel accepted this revision.Jul 25 2019, 6:01 AM

LGTM

This revision was automatically updated to reflect the committed changes.