[InstCombine] Compute known bits for multi-use add/sub
authorNikita Popov <npopov@redhat.com>
Wed, 17 May 2023 15:36:05 +0000 (17:36 +0200)
committerNikita Popov <npopov@redhat.com>
Wed, 17 May 2023 15:50:00 +0000 (17:50 +0200)
commit745cfa3449cd180949ae2ec31dae6c2fcb3e473c
treee70d73802cbbf5c40f06291783332237f64c41ea
parentebc111b08bddca55d5f7e560a20bdb2c913d80cb
[InstCombine] Compute known bits for multi-use add/sub

We were failing to set the known bits for add/sub in the multi-use
case, resulting in odd behavioral differences depending on the
number of uses. Noticed while adding a consistency assertion.

The test changes are essentially a revert to the state before
d6498ab. These changes are not really desirable, but if we don't
want them, that needs to be handled as part of the heuristic for
demanded constant shrinking, not by artifically suppressing the
known bits in one specific case.
llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
llvm/test/Transforms/LoopVectorize/induction.ll
llvm/test/Transforms/LoopVectorize/interleaved-accesses.ll
llvm/test/Transforms/LoopVectorize/invariant-store-vectorization.ll
llvm/test/Transforms/LoopVectorize/loop-scalars.ll