[llvm] [InstCombine] Simplify phi using KnownBits of condition (PR #134712)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 7 21:00:06 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);
----------------
dtcxzyw wrote:
```suggestion
for (unsigned I = 0, E = PN.getNumIncomingValues(); I != E; ++I) {
SimplifyQuery Q = SQ.getWithInstruction(PN.getIncomingBlock(I)->getTerminator());
Value *V = PN.getIncomingValue(I);
```
https://github.com/llvm/llvm-project/pull/134712
More information about the llvm-commits
mailing list