[GlobalISel] Combine `undef / X -> 0` and `undef % X -> 0`
authorJessica Paquette <jpaquette@apple.com>
Sat, 1 Oct 2022 20:36:39 +0000 (13:36 -0700)
committerJessica Paquette <jpaquette@apple.com>
Sat, 1 Oct 2022 20:48:55 +0000 (13:48 -0700)
commit24553df57dcc7bb2567697d8697b37ffbbac0bac
tree4d58dfff85d8473d032097cd36bdbac126b0947a
parent3b0df701b0d95612e5da3544e2361808b78a6015
[GlobalISel] Combine `undef / X -> 0` and `undef % X -> 0`

This fixes the `urem_undef_lhs` case in the following:

https://gcc.godbolt.org/z/Wo9x7o679

Also see https://github.com/llvm/llvm-project/issues/57256 for more related
bugs.

This is equivalent to the undef bits in `simplifyDivRem` in the DAGCombiner.

Differential Revision: https://reviews.llvm.org/D135020
llvm/include/llvm/Target/GlobalISel/Combine.td
llvm/test/CodeGen/AArch64/GlobalISel/combine-binop-undef-left-to-zero.mir [new file with mode: 0644]
llvm/test/CodeGen/AArch64/GlobalISel/combine-shl.mir [deleted file]