[llvm] 77aaba6 - [InstCombine] Compute bits of first operand for multi-use sub
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed May 17 09:34:25 PDT 2023
Author: Nikita Popov
Date: 2023-05-17T18:34:17+02:00
New Revision: 77aaba6aae9667e5091bf35b1cfdef995840a8c9
URL: https://github.com/llvm/llvm-project/commit/77aaba6aae9667e5091bf35b1cfdef995840a8c9
DIFF: https://github.com/llvm/llvm-project/commit/77aaba6aae9667e5091bf35b1cfdef995840a8c9.diff
LOG: [InstCombine] Compute bits of first operand for multi-use sub
Otherwise the result will always be unknown anyway. This fixes one
of the last inconsistencies in results between computeKnownBits()
and SimplifyDemandedBits().
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
index 5a7ff48efd9c..ac824b275d38 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
@@ -1090,6 +1090,7 @@ Value *InstCombinerImpl::SimplifyMultipleUseDemandedBits(
return I->getOperand(0);
bool NSW = cast<OverflowingBinaryOperator>(I)->hasNoSignedWrap();
+ computeKnownBits(I->getOperand(0), LHSKnown, Depth + 1, CxtI);
Known = KnownBits::computeForAddSub(/*Add*/ false, NSW, LHSKnown, RHSKnown);
break;
}
More information about the llvm-commits
mailing list