[llvm] [InstCombine] Simplify phi using KnownBits of condition (PR #134712)
Andreas Jonson via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 7 22:48:16 PDT 2025
================
@@ -840,17 +840,28 @@ void llvm::computeKnownBitsFromContext(const Value *V, KnownBits &Known,
if (Q.DC && Q.DT) {
// Handle dominating conditions.
- for (BranchInst *BI : Q.DC->conditionsFor(V)) {
- BasicBlockEdge Edge0(BI->getParent(), BI->getSuccessor(0));
- if (Q.DT->dominates(Edge0, Q.CxtI->getParent()))
- computeKnownBitsFromCond(V, BI->getCondition(), Known, Depth, Q,
- /*Invert*/ false);
+ const BasicBlock *CxtIBB = Q.CxtI->getParent();
+ if (isa<PHINode>(Q.CxtI))
----------------
andjo403 wrote:
I think that we need some special handling here as we only want to evaluate the branch that is in the PHI for this condition. also do not think that using the condition as CxtI will pass the domination check as the BasicBlockEdge is brBB, phiBB and we check that it dominates brBB.
https://github.com/llvm/llvm-project/pull/134712
More information about the llvm-commits
mailing list