[PATCH] D148414: [InstCombine] Expand `foldSelectICmpAndOr` -> `foldSelectICmpAndBinOp` to work for more binops
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 25 10:26:48 PDT 2023
goldstein.w.n added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:797
- return Builder.CreateOr(V, Y);
+ return Builder.CreateBinOp(BinOp->getOpcode(), V, Y);
}
----------------
chapuni wrote:
> Would it be right if `BinOp` is not commutative?
> I saw a malformed `lshr` in the miscompilation.
>
> `%spec.select = lshr i64 %sub78, %foo` was transformed to `%spec.select = lshr i64 %bar, %sub78`.
Yup, this is it. Didn't see that original code had inverted the operands.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148414/new/
https://reviews.llvm.org/D148414
More information about the llvm-commits
mailing list