@@ -1005,47 +1005,10 @@ bool JumpThreading::ProcessThreadableEdges(Instruction *CondInst,
1005
1005
bool JumpThreading::ProcessJumpOnPHI (PHINode *PN) {
1006
1006
BasicBlock *BB = PN->getParent ();
1007
1007
1008
- // See if the phi node has any constant integer or undef values. If so, we
1009
- // can determine where the corresponding predecessor will branch.
1010
- for (unsigned i = 0 , e = PN->getNumIncomingValues (); i != e; ++i) {
1011
- Value *PredVal = PN->getIncomingValue (i);
1012
-
1013
- // Check to see if this input is a constant integer. If so, the direction
1014
- // of the branch is predictable.
1015
- if (ConstantInt *CI = dyn_cast<ConstantInt>(PredVal)) {
1016
- // Merge any common predecessors that will act the same.
1017
- BasicBlock *PredBB = FactorCommonPHIPreds (PN, CI);
1018
-
1019
- BasicBlock *SuccBB;
1020
- if (BranchInst *BI = dyn_cast<BranchInst>(BB->getTerminator ()))
1021
- SuccBB = BI->getSuccessor (CI->isZero ());
1022
- else {
1023
- SwitchInst *SI = cast<SwitchInst>(BB->getTerminator ());
1024
- SuccBB = SI->getSuccessor (SI->findCaseValue (CI));
1025
- }
1026
-
1027
- // Ok, try to thread it!
1028
- return ThreadEdge (BB, PredBB, SuccBB);
1029
- }
1030
-
1031
- // If the input is an undef, then it doesn't matter which way it will go.
1032
- // Pick an arbitrary dest and thread the edge.
1033
- if (UndefValue *UV = dyn_cast<UndefValue>(PredVal)) {
1034
- // Merge any common predecessors that will act the same.
1035
- BasicBlock *PredBB = FactorCommonPHIPreds (PN, UV);
1036
- BasicBlock *SuccBB =
1037
- BB->getTerminator ()->getSuccessor (GetBestDestForJumpOnUndef (BB));
1038
-
1039
- // Ok, try to thread it!
1040
- return ThreadEdge (BB, PredBB, SuccBB);
1041
- }
1042
- }
1043
-
1044
- // If the incoming values are all variables, we don't know the destination of
1045
- // any predecessors. However, if any of the predecessor blocks end in an
1046
- // unconditional branch, we can *duplicate* the jump into that block in order
1047
- // to further encourage jump threading and to eliminate cases where we have
1048
- // branch on a phi of an icmp (branch on icmp is much better).
1008
+ // If any of the predecessor blocks end in an unconditional branch, we can
1009
+ // *duplicate* the jump into that block in order to further encourage jump
1010
+ // threading and to eliminate cases where we have branch on a phi of an icmp
1011
+ // (branch on icmp is much better).
1049
1012
1050
1013
// We don't want to do this tranformation for switches, because we don't
1051
1014
// really want to duplicate a switch.
0 commit comments