[SelectionDAG][GlobalISel] Don't use UnsignedDivisionByConstantInfo for divisor of 1.
authorCraig Topper <craig.topper@sifive.com>
Wed, 4 Jan 2023 02:36:14 +0000 (18:36 -0800)
committerCraig Topper <craig.topper@sifive.com>
Wed, 4 Jan 2023 18:01:15 +0000 (10:01 -0800)
commit8bca60fb0aa5f82d32e619d75e65d0dea2472722
treef6e07c11caa486e57ff70023ed77841aecddad93
parentfb13dcf3431cd83911fe56899d2fade808dc5b8d
[SelectionDAG][GlobalISel] Don't use UnsignedDivisionByConstantInfo for divisor of 1.

The magic algorithm sets IsAdd indication for division by 1 that
the caller had to ignore.

I considered folding the ignore into UnsignedDivisionByConstantInfo,
but we only allow 1 for vectors of mixed visiors. And really what we
want to end up with is undef. Currently, we get to undef via
DemandedElts optimizations using the select instruction. We could
directly emit undef.

Differential Revision: https://reviews.llvm.org/D140940
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/lib/Support/DivisionByConstantInfo.cpp
llvm/unittests/Support/DivisionByConstantTest.cpp