This is an archive of the discontinued LLVM Phabricator instance.

Factor check for the assume intrinsic out of checks in computeKnownBitsFromAssume
ClosedPublic

Authored by reames on Nov 18 2014, 11:48 AM.

Details

Summary

We were matching against the assume intrinsic in every check. Since we know that it must be an assume, this is just wasted work. Somewhat surprisingly, matching an intrinsic id is actually relatively expensive. It devolves to a string construction and comparison in Function::isIntrinsic.

I originally spotted this because it showed up in a performance profile of my compiler. I've since discovered a separate issue which seems to be the actual root cause, but this is minor perf goodness regardless.

I'm likely to follow up with another change to factor out the comparison matching. There's no need to match the compare instruction in every single one of the tests.

Diff Detail

Repository
rL LLVM

Event Timeline

reames updated this revision to Diff 16347.Nov 18 2014, 11:48 AM
reames retitled this revision from to Factor check for the assume intrinsic out of checks in computeKnownBitsFromAssume.
reames updated this object.
reames edited the test plan for this revision. (Show Details)
reames added a reviewer: hfinkel.
reames added a subscriber: Unknown Object (MLST).
hfinkel accepted this revision.Nov 24 2014, 1:41 PM
hfinkel edited edge metadata.

LGTM. Thanks!

lib/Analysis/ValueTracking.cpp
494 ↗(On Diff #16347)

sensative -> sensitive

498 ↗(On Diff #16347)

No need for extra space after (

This revision is now accepted and ready to land.Nov 24 2014, 1:41 PM
reames closed this revision.Nov 24 2014, 3:44 PM
reames updated this revision to Diff 16589.

Closed by commit rL222709 (authored by @reames).