[InstCombine] Fix known bits handling in SimplifyDemandedUseBits
authorNikita Popov <nikita.ppv@gmail.com>
Sat, 7 Mar 2020 11:18:05 +0000 (12:18 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Sat, 7 Mar 2020 17:16:41 +0000 (18:16 +0100)
commit51a466a61f55a0e1111005911f06e6394a5057ca
tree1839c2e469f45e715eb43b6b2a07d8c8a17332b5
parenta4e71f01c08fbaeaccfe3e11cc08790432cc7e45
[InstCombine] Fix known bits handling in SimplifyDemandedUseBits

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.

Differential Revision: https://reviews.llvm.org/D75804
llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
llvm/test/Transforms/InstCombine/all-bits-shift.ll
llvm/test/Transforms/InstCombine/known-bits.ll