[InstCombine] Fix missed opportunity to fold 'or' into 'mul' operand. (#74225)
commite3b3c91dd0bbc8bd6f1ee562641daf1e554eb1b6
authorCraig Topper <craig.topper@sifive.com>
Sun, 3 Dec 2023 08:51:22 +0000 (3 00:51 -0800)
committerGitHub <noreply@github.com>
Sun, 3 Dec 2023 08:51:22 +0000 (3 00:51 -0800)
tree68b6adafe0cd2d728821bc385ede159dba66da74
parentecc080c07d97f7879ce64e644cac828922a7b0d9
[InstCombine] Fix missed opportunity to fold 'or' into 'mul' operand. (#74225)

We were able to fold
or (mul X, Y), X --> mul X, (add Y, 1) (when the multiply has no common
bits with X)

This patch makes the transform work if the mul operands are commuted.
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
llvm/test/Transforms/InstCombine/or.ll