[DAG] Fix issue with rot(rot(x,c1),c2) -> rot(x,c1+c2) fold with unnormalized rotatio...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 3 May 2022 16:16:17 +0000 (17:16 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 3 May 2022 16:16:26 +0000 (17:16 +0100)
commitfaa35fc873700b6d3e61e652c887b82d1cea7c0c
treea6ea826e2fcf52a012bea4e67db2e1d74eb5517b
parent2deebc0048f92811dc92c7e41d357683b84febf7
[DAG] Fix issue with rot(rot(x,c1),c2) -> rot(x,c1+c2) fold with unnormalized rotation amounts

Don't assume the rotation amounts have been correctly normalized - do it as part of the constant folding.

Also, the normalization should be performed with UREM not SREM.
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/combine-rotates.ll