[llvm] [InstCombine] Don't use dominating conditions to transform sub into xor. (PR #88566)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 12 13:39:43 PDT 2024
================
@@ -2281,8 +2281,10 @@ Instruction *InstCombinerImpl::visitSub(BinaryOperator &I) {
if (match(Op0, m_APInt(Op0C))) {
if (Op0C->isMask()) {
// Turn this into a xor if LHS is 2^n-1 and the remaining bits are known
- // zero.
- KnownBits RHSKnown = computeKnownBits(Op1, 0, &I);
+ // zero. We don't use information from dominating conditions so this
+ // transform is easier to reverse if necessary.
+ KnownBits RHSKnown = llvm::computeKnownBits(
+ Op1, 0, SQ.getWithInstruction(&I).getWithoutDomCondCache());
----------------
goldsteinn wrote:
Is there a motivating case for when we would need/want to?
https://github.com/llvm/llvm-project/pull/88566
More information about the llvm-commits
mailing list