[InstCombine] Fix inversion of constants
authorRoman Lebedev <lebedev.ri@gmail.com>
Tue, 20 Dec 2022 15:15:19 +0000 (18:15 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Tue, 20 Dec 2022 15:20:32 +0000 (18:20 +0300)
commite51b7bff192f5c2712009a28eed1544ff45913c1
tree3df2b31a753c4f13fe126accbed25fa63ca1b09d
parent306adcc852c343fb01ab4189330f597ce90a1912
[InstCombine] Fix inversion of constants

`canFreelyInvertAllUsersOf()`, in general, does not make sense
for constants, and constant expressions are likely even more problematic.
For those, we just want to create a simple constant expression and be done.

Fixes https://github.com/llvm/llvm-project/issues/59613
llvm/include/llvm/Transforms/InstCombine/InstCombiner.h
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
llvm/test/Transforms/InstCombine/pr59613.ll [new file with mode: 0644]