Home | History | Annotate | Download | only in InstCombine

Lines Matching refs:Phi

23 /// If we have something like phi [add (a,b), add(a,c)] and if a/b/c and the
24 /// adds all have a single use, turn this into a phi and a single binop.
66 // Keep track of which operand needs a phi node.
71 // If both LHS and RHS would need a PHI, don't do this transformation,
140 // We don't want to replace this phi if the replacement would require
141 // more than one phi, which leads to higher register pressure. This is
167 // Don't merge two GEPs when two operands differ (introducing phi nodes)
179 // If we already needed a PHI for an earlier operand, and another operand
180 // also requires a PHI, we'd be introducing more PHIs than we're
181 // eliminating, which increases register pressure on entry to the PHI's
186 FixedOperands[op] = nullptr; // Needs a PHI.
191 // If all of the base pointers of the PHI'd GEPs are from allocas, don't
200 // Otherwise, this is safe to transform. Insert PHI nodes for each operand
206 if (FixedOperands[i]) continue; // operand doesn't need a phi.
304 // load and the PHI.
309 // If the PHI is of volatile loads and the load block has multiple
323 // the load and the PHI.
337 // If the PHI is of volatile loads and the load block has multiple
345 // Okay, they are all the same operation. Create a new PHI node of the
346 // correct type, and PHI together all of the LHS's of the instructions.
370 // Add all operands to the new PHI and combine TBAA metadata.
381 // The new PHI unions all of the same values together. This is really
403 Instruction *InstCombiner::FoldPHIArgZextsIntoPHI(PHINode &Phi) {
404 // We cannot create a new instruction after the PHI if the terminator is an
406 if (TerminatorInst *TI = Phi.getParent()->getTerminator())
410 // Early exit for the common case of a phi with two operands. These are
413 unsigned NumIncomingValues = Phi.getNumIncomingValues();
419 for (Value *V : Phi.incoming_values()) {
428 // Walk the phi operands checking that we only have zexts or constants that
429 // we can shrink for free. Store the new operands for the new phi.
433 for (Value *V : Phi.incoming_values()) {
453 // The more common cases of a phi with no constant operands or just one
456 // performed here. It tries to replicate a cast in the phi operand's basic
463 // Create a new phi node of the narrow type, phi together all of the new
466 Phi.getName() + ".shrunk");
468 NewPhi->addIncoming(NewIncoming[i], Phi.getIncomingBlock(i));
470 InsertNewInstBefore(NewPhi, Phi);
471 return CastInst::CreateZExtOrBitCast(NewPhi, Phi.getType());
474 /// If all operands to a PHI node are the same "unary" operator and they all are
475 /// only used by the PHI, PHI together their inputs, and do the operation once,
476 /// to the result of the PHI.
478 // We cannot create a new instruction after the PHI if the terminator is an
492 // If all input operands to the phi are the same instruction (e.g. a cast from
493 // the same type or "+42") we can pull the operation through the PHI, reducing
546 // Okay, they are all the same operation. Create a new PHI node of the
547 // correct type, and PHI together all of the LHS's of the instructions.
555 // Add all operands to the new PHI.
565 // The new PHI unions all of the same values together. This is really
598 /// Return true if this PHI node is only used by a PHI node cycle that is dead.
618 /// Return true if this phi node is always equal to NonPhiInVal.
619 /// This happens with mutually cyclic phi nodes like:
620 /// z = some value; x = phi (y, z); y = phi (x, z)
623 // See if we already saw this PHI node.
631 // Scan the operands to see if they are either phi nodes or are equal to
647 unsigned PHIId; // The ID # of the PHI (something determinstic to sort on)
665 PHINode *PN; // The PHI that was lowered.
700 /// This is an integer PHI and we know that it has an illegal type: see if it is
701 /// only used by trunc or trunc(lshr) operations. If so, we split the PHI into
713 // PHIs are often mutually cyclic, so we keep track of a whole set of PHI
726 // Scan the input list of the PHI. If any input is an invoke, and if the
736 // If we have a phi, and if it's directly in the predecessor, then we have
745 // If the user is a PHI, inspect its uses recursively.
769 // If we have no users, they must be all self uses, just nuke the PHI.
773 // If this phi node is transformable, create new PHIs for all the pieces
777 DEBUG(dbgs() << "SLICING UP PHI: " << FirstPhi << '\n';
779 dbgs() << "AND USER PHI #" << i << ": " << *PHIsToSlice[i] << '\n';
782 // PredValues - This is a temporary used when rewriting PHI nodes. It is
786 // ExtractedVals - Each new PHI we introduce is saved here so we don't
802 // Otherwise, Create the new PHI node for this user.
806 "Truncate didn't shrink phi?");
818 // Handle the PHI self-reuse case.
827 // If the incoming value was a PHI, and if it was one of the PHIs we
846 // If the incoming value was a PHI
848 // means we need to revisit that PHI to make sure we extract out the
861 DEBUG(dbgs() << " Made element PHI for offset " << Offset << ": "
866 // Replace the use of this piece with the PHI node.
870 // Replace all the remaining uses of the PHI nodes (self uses and the lshrs)
887 // If all PHI operands are the same operation, pull them through the PHI,
899 // If this is a trivial cycle in the PHI node graph, remove it. Basically, if
900 // this PHI only has a single use (a PHI), and if that PHI only has one use (a
901 // PHI)... break the cycle.
911 // If this phi has a single use, and if that use just computes a value for
912 // the next iteration of a loop, delete the phi. This occurs with unused
924 // We sometimes end up with phi cycles that non-obviously end up being the
926 // z = some value; x = phi (y, z); y = phi (x, z)
927 // where the phi nodes don't necessarily need to be in the same block. Do a
928 // quick check to see if the PHI node only contains a single non-phi value, if
929 // so, scan to see if the phi cycle is actually equal to that value.
932 // Scan for the first non-phi operand.
949 // phi values. Scan PHI nodes to see if they all merge in each other or
983 // If this is an integer PHI and we know that it has an illegal type, see if
985 // PHI into the various pieces being extracted. This sort of thing is