[llvm] [InstCombine] Simplify phi using KnownBits of condition (PR #134712)
Andreas Jonson via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 7 23:10:56 PDT 2025
================
@@ -1625,6 +1625,25 @@ Instruction *InstCombinerImpl::visitPHINode(PHINode &PN) {
return replaceInstUsesWith(PN, &IdenticalPN);
}
+ if (PN.getType()->isIntegerTy()) {
+ bool MadeChange = false;
+ SimplifyQuery Q = SQ.getWithInstruction(&PN);
+ for (unsigned I = 0, E = PN.getNumIncomingValues(); I != E; ++I) {
+ Value *V = PN.getIncomingValue(I);
+ if (isa<ConstantInt>(V))
+ continue;
+
----------------
andjo403 wrote:
hmm one test failed when I tried this so not only for conditional branches that this simplify
https://github.com/llvm/llvm-project/pull/134712
More information about the llvm-commits
mailing list