Fixes a regression from D75801. SimplifyDemandedUseBits() is also supposed to compute the known bits (of the demanded subset) of the instruction. For unknown instructions it does so by directly calling computeKnownBits(). For known instructions it will compute known bits itself. However, for instructions where only some cases are handled directly (e.g. a constant shift amount) the known bits invocation for the unhandled case is sometimes missing. This patch adds the missing calls and thus removes the main discrepancy with ExpensiveCombines mode.
Details
Diff Detail
Event Timeline
Some comments on the intrinsics code, as it did some weird things before...
lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp | ||
---|---|---|
719 | Despite what the comment says, this was already computing known bits, because the "break" falls through to the call below. | |
752 | While known bits were computed explicitly here, this break would still fall through to the known bits call below, and thus recompute the result from scratch. | |
781 | This return nullptr skipped the bit of code for returning a constant integer below. | |
790 | To avoid the three issues mentioned above, I'm now explicitly tracking whether known bits were computed or not for the call. |
Despite what the comment says, this was already computing known bits, because the "break" falls through to the call below.