[DAGCombiner] Fix issue with rot chain pattern
authorchenglin.bi <chenglin.bi@linaro.org>
Tue, 10 Jan 2023 17:28:43 +0000 (01:28 +0800)
committerchenglin.bi <chenglin.bi@linaro.org>
Tue, 10 Jan 2023 17:29:09 +0000 (01:29 +0800)
commitbe7d0d6db5094f2709c028ce6b62936f51db8bc9
treea777769ecbcf6943753ef2f6087d24a19c3217f8
parentb84ab1f7c9b87cb0a0bea26dc4299c4fd19df548
[DAGCombiner] Fix issue with rot chain pattern

faa35fc87370 fix the case of negative input shift. But when `c1`, `c2` is not the same side, it will also cause negative shift amount.
And that negative shift amount can't normalize by urem. So add one more bit size to normalize the last shift amount.

Fix: https://github.com/llvm/llvm-project/issues/59898

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D141363
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AArch64/rotate.ll