Home | History | Annotate | Download | only in Utils

Lines Matching defs:Phi

61 PHINodeFoldingThreshold("phi-node-folding-threshold", cl::Hidden, cl::init(2),
62 cl::desc("Control the amount of phi node folding to perform (default = 2)"));
90 // The first field contains the phi node that generates a result of the switch
92 // for that PHI.
148 // successor, and if that successor has a PHI node, and if *that* PHI node has
169 /// unconditional branch. PhiNodes will store all PHI nodes in common
179 // We fold the unconditional branch if we can easily update all PHI nodes in
208 /// AddPredecessorToBlock - Update PHI nodes in Succ to indicate that there will
210 /// flowing into the PHI nodes will be the same as those coming in from
664 // Remove PHI node entries for the dead edge.
737 // Remove PHI node entries for dead edges.
976 // sure we update the number of entries in the PHI nodes for these
1165 // Unfortunately, the successors of the if/else blocks may have PHI nodes in
1166 // them. If they do, all PHI entries for BB1/BB2 must agree for all PHI
1185 // Make the PHI node use the select for all incoming values for BB1/BB2
1192 // Update any PHI nodes in our new successors.
1223 // Gather the PHI nodes in BBEnd.
1269 // I1 and I2 should have a single use in the same PHI node, and they
1301 // with a PHI node after sinking. We only handle the case where there is
1309 // we need a PHI node to replace a constant.
1336 DEBUG(dbgs() << "Create PHI node " << *NewPN << "\n";);
1454 /// %phi = phi [ %sub, %ThenBB ], [ 0, %EndBB ]
1551 // Check that the PHI nodes can be converted to selects.
1617 // Insert selects and rewrite the PHI operands.
1684 /// FoldCondBranchOnPHI - If we have a conditional branch on a PHI node value
1685 /// that is defined in the same block as the branch and if any PHI entries are
1691 // NOTE: we currently cannot transform this case if the PHI node is used
1696 // Degenerate case of a single entry PHI.
1707 // Okay, this is a simple enough basic block. See if any phi values are
1722 // The dest block might have PHI nodes, other predecessors and other
1731 // Update PHI nodes.
1785 /// PHI node, see if we can eliminate it.
1788 // Ok, this is a two entry PHI node. Check to see if this is a simple "if
1802 // Okay, we found that we can merge this two-entry phi node into a select.
1803 // Doing so would require us to fold *all* two entry phi nodes in this block.
1806 // fewer PHI nodes in this block.
1812 // Loop over the PHI's seeing if we can promote them all to select
1836 // If we folded the first phi, PN dangles at this point. Refresh it. If
1849 // If we all PHI nodes are promotable, check to make sure that all
1885 // If we can still promote the PHI nodes after this gauntlet of tests,
1886 // do all of the PHI's now.
1902 // Change the PHI node into a select instruction.
1935 // with PHI nodes. If there are other instructions, merging would cause extra
1959 // Unwrap any PHI nodes in the return blocks.
2142 // Check that we have two conditional branches. If there is a PHI node in
2282 // Update PHI nodes in the common successors.
2322 // Update PHI Node.
2368 // Otherwise, if there are multiple predecessors, insert a PHI that merges
2377 // Okay, we're going to insert the PHI node. Since PBI is not the only
2378 // predecessor, compute the PHI'd conditional value for all of the preds.
2436 // Also do not perform this transformation if any phi node in the common
2531 // OtherDest may have phi nodes. If so, add an entry from PBI's
2696 /// ... = phi i1 [ true, %entry ], [ %tmp, %DEFAULT ], [ true, %entry ]
2699 /// the PHI, merging the third icmp into the switch.
2755 // The use of the icmp has to be in the 'end' block, by the only PHI node in
2764 // true in the PHI.
2771 // Replace ICI (which is used by the PHI for the default value) with true or
2797 // NewBB branches to the phi block, add the uncond branch and the phi entry.
2872 // If there are PHI nodes in EdgeBB, then we need to add a new entry to them
2896 // PHI nodes in EdgeBB, they need entries to be added corresponding to
3222 // Prune obsolete incoming values off the successors' PHI nodes.
3279 // Prune unused values from PHI nodes.
3295 /// by an unconditional branch), look at the phi node for BB in the successor
3297 /// the phi node, and set PhiIndex to BB's index in the phi node.
3313 while (PHINode *PHI = dyn_cast<PHINode>(I++)) {
3314 int Idx = PHI->getBasicBlockIndex(BB);
3315 assert(Idx >= 0 && "PHI has no entry for predecessor?");
3317 Value *InValue = PHI->getIncomingValue(Idx);
3321 return PHI;
3328 /// instruction to a phi node dominated by the switch, if that would mean that
3340 PHINode *PHI = FindPHIForConditionForwarding(CaseValue, CaseDest,
3342 if (!PHI) continue;
3344 ForwardingNodes[PHI].push_back(PhiIndex);
3351 PHINode *Phi = I->first;
3357 Phi->setIncomingValue(Indexes[I], SI->getCondition());
3425 /// GetCaseResults - Try to determine the resulting constant values in phi nodes
3455 // If the instruction has uses outside this block or a phi node slot for
3463 if (PHINode *Phi = dyn_cast<PHINode>(User))
3464 if (Phi->getIncomingBlock(Use) == CaseDest)
3482 // Get the values for this case from phi nodes in the destination block.
3484 while (PHINode *PHI = dyn_cast<PHINode>(I++)) {
3485 int Idx = PHI->getBasicBlockIndex(Pred);
3489 Constant *ConstVal = LookupConstant(PHI->getIncomingValue(Idx),
3498 Res.push_back(std::make_pair(PHI, ConstVal));
3520 // results for the PHI node of the common destination block for a switch
3521 // instruction. Returns false if multiple PHI nodes have been found or if
3523 static bool InitializeUniqueCases(SwitchInst *SI, PHINode *&PHI,
3531 // Resulting value at phi nodes for this case value.
3542 // Check the PHI consistency.
3543 if (!PHI)
3544 PHI = Results[0].first;
3545 else if (PHI != Results[0].first)
3607 // instruction that has been converted into a select, fixing up PHI nodes and
3609 static void RemoveSwitchAfterSelectConversion(SwitchInst *SI, PHINode *PHI,
3613 while (PHI->getBasicBlockIndex(SelectBB) >= 0)
3614 PHI->removeIncomingValue(SelectBB);
3615 PHI->addIncoming(SelectValue, SelectBB);
3617 Builder.CreateBr(PHI->getParent());
3623 if (Succ == PHI->getParent())
3631 /// phi nodes in a common successor block with only two different
3636 PHINode *PHI = nullptr;
3641 if (!InitializeUniqueCases(SI, PHI, CommonDest, UniqueResults, DefaultResult,
3647 assert(PHI != nullptr && "PHI for value select not found");
3654 RemoveSwitchAfterSelectConversion(SI, PHI, SelectValue, Builder);
3981 // We require that the compare is in the same block as the phi so that jump
4011 // Check if the branch instruction dominates the phi node. It's a simple
4037 /// phi nodes in a common successor block with different constant values,
4060 // Figure out the corresponding result for each case value and phi node in the
4081 // Resulting value at phi nodes for this case value.
4088 // Append the result from this case to the list for each phi.
4090 PHINode *PHI = I.first;
4092 if (!ResultLists.count(PHI))
4093 PHIs.push_back(PHI);
4094 ResultLists[PHI].push_back(std::make_pair(CaseVal, Value));
4099 for (PHINode *PHI : PHIs) {
4100 ResultTypes[PHI] = ResultLists[PHI][0].second->getType();
4124 PHINode *PHI = I.first;
4126 DefaultResults[PHI] = Result;
4219 PHINode *PHI = PHIs[I];
4220 const ResultListTy &ResultList = ResultLists[PHI];
4223 Constant *DV = NeedMask ? ResultLists[PHI][0].second : DefaultResults[PHI];
4230 if (PHI->hasOneUse() && isa<ReturnInst>(*PHI->user_begin()) &&
4231 PHI->user_back() == CommonDest->getFirstNonPHIOrDbg()) {
4240 BasicBlock *PhiBlock = PHI->getParent();
4241 // Search for compare instructions which use the phi.
4242 for (auto *User : PHI->users()) {
4247 PHI->addIncoming(Result, LookupBB);
4366 /// merging any blocks which require us to introduce a phi. Since the same
4370 /// TODO - This transformation could remove entries from a phi in the target
4371 /// block when the inputs in the phi are the same for the two blocks being
4372 /// merged. In some cases, this could result in removal of the PHI entirely.
4377 // If there's a phi in the successor block, we'd likely have to introduce
4378 // a phi into the merged landing pad block.
4434 // If the Terminator is the only non-phi instruction, simplify the block.
4464 // for PHI nodes in common successor.
4539 // If this is a branch on a phi node in the current block, thread control
4540 // through this block if any PHI node entries are constants.
4601 PHINode *PHI = dyn_cast<PHINode>(i); ++i)
4602 for (unsigned i = 0, e = PHI->getNumIncomingValues(); i != e; ++i)
4603 if (passingValueIsAlwaysUndefined(PHI->getIncomingValue(i), PHI)) {
4604 TerminatorInst *T = PHI->getIncomingBlock(i)->getTerminator();
4607 BB->removePredecessor(PHI->getIncomingBlock(i));
4644 // Check for and eliminate duplicate PHI nodes in this block.
4652 // if there are no PHI nodes.
4659 // If there is a trivial two-entry PHI node in this basic block, and we can