[SelectionDAG] Fold abs(undef) to 0 instead of undef.
authorCraig Topper <craig.topper@sifive.com>
Sun, 22 May 2022 19:47:27 +0000 (12:47 -0700)
committerCraig Topper <craig.topper@sifive.com>
Sun, 22 May 2022 19:47:32 +0000 (12:47 -0700)
commit768a1ca5eccb678947f4155e38a5f5744dcefb56
tree8336441271ead2e9b5cdefe6f971470e74edf7c0
parent419e49621fb4b7cc2a46b09cd04020c083f7d64b
[SelectionDAG] Fold abs(undef) to 0 instead of undef.

abs should only produce a positive value or the signed minimum
value. This means we can't fold abs(undef) to undef as that would
allow more values. Fold to 0 instead to match InstSimplify.

Fixes test mentioned in comment on pr55271.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D126174
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/test/CodeGen/X86/pr55271.ll [new file with mode: 0644]