Page MenuHomePhabricator

Invariant intrinsic canonicalization
ClosedPublic

Authored by hfinkel on Jul 13 2014, 10:44 PM.

Details

Reviewers
chandlerc
Summary

This patch adds some simple canonicalization of invariant intrinsics to instcombine. For now, only this:

invariant(a && b) -> invariant(a); invariant(b)

Diff Detail

Event Timeline

hfinkel updated this revision to Diff 11362.Jul 13 2014, 10:44 PM
hfinkel retitled this revision from to Invariant intrinsic canonicalization.
hfinkel updated this object.
hfinkel edited the test plan for this revision. (Show Details)
hfinkel added a reviewer: chandlerc.
hfinkel added a subscriber: Unknown Object (MLST).
hfinkel updated this revision to Diff 11397.Jul 14 2014, 10:43 AM

No change, but rebased against the latest version of http://reviews.llvm.org/D4490 (because this patch adds to the end of the same regression test).

hfinkel updated this revision to Diff 11444.Jul 15 2014, 9:22 AM

Also canonicalize: invariant(!(a || b)) -> invariant(!a); invariant(!b);

chandlerc accepted this revision.Jul 17 2014, 11:55 AM
chandlerc edited edge metadata.

LGTM (when the prerequisite stuff is settled)

This revision is now accepted and ready to land.Jul 17 2014, 11:55 AM
hfinkel updated this revision to Diff 11697.Jul 20 2014, 11:59 AM
hfinkel edited edge metadata.

Renamed to llvm.assume.

reames added a subscriber: reames.Jul 21 2014, 10:45 AM

LGTM.

lib/Transforms/InstCombine/InstCombineCalls.cpp
1004

Extracting out II->getCalledValue with a name like "AssumeIntrinsic" would make this code easier to understand on first glance.

hfinkel closed this revision.Jul 25 2014, 2:54 PM

r213977, thanks!

lib/Transforms/InstCombine/InstCombineCalls.cpp
1004

Done.