[RISCV] Don't remove (and X, 0xffffffff) from inputs when matching RISCVISD::DIVUW...
authorCraig Topper <craig.topper@sifive.com>
Fri, 27 Nov 2020 06:31:13 +0000 (22:31 -0800)
committerCraig Topper <craig.topper@sifive.com>
Fri, 27 Nov 2020 07:15:41 +0000 (23:15 -0800)
commite0481048abd33079261c9aa701c0916a52941dc3
tree2e9fb06affd103861ccb829175b08584022343a7
parent0077e1680f83cf2ae014c7f3c2847fe106e24a5f
[RISCV] Don't remove (and X, 0xffffffff) from inputs when matching RISCVISD::DIVUW/REMUW to 64-bit DIVU/REMU.

These patterns are using zexti32 which matches either assertzexti32
or (and X, 0xffffffff). But if we match (and X, 0xffffffff) it will
remove the AND and the inputs may no longer have the zero bits
needed to guarantee the result has enough zeros.

This commit changes the patterns to only match assertzexti32.
I'm not sure how to test the broken case since the DIVUW/REMUW nodes
are created during type legalization, but type legalization won't
create an (and X, 0xfffffffff) directly on the inputs.

I've also changed the zexti32 on the root of the pattern to just
checking for AND. We were previously also matching assertzexti32,
but I doubt that pattern would ever occur.
llvm/lib/Target/RISCV/RISCVInstrInfoM.td