Factor check for the assume intrinsic out of checks in computeKnownBitsFromAssume
authorPhilip Reames <listmail@philipreames.com>
Mon, 24 Nov 2014 23:44:28 +0000 (23:44 +0000)
committerPhilip Reames <listmail@philipreames.com>
Mon, 24 Nov 2014 23:44:28 +0000 (23:44 +0000)
commit00d3b279cbdad40d27098754820b5951ff9328d8
tree06f3e169ef574b6ee6a066b7e111eed1ba6c57d2
parent4e21001baca051f3ac1907bbac02f89e66b139fe
Factor check for the assume intrinsic out of checks in computeKnownBitsFromAssume

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.

Differential Revision: http://reviews.llvm.org/D6312

llvm-svn: 222709
llvm/lib/Analysis/ValueTracking.cpp