Revert "Don't create unnecessary PHIs"
[oota-llvm.git] / lib / Transforms / Utils / SimplifyCFG.cpp
index 74b7c0602b3116b5b7331facbd0e9cb202623199..b2b52246a7eb3457f22dc6ef49fcf8cc9ce72519 100644 (file)
@@ -2385,11 +2385,6 @@ static Value *ensureValueAvailableInSuccessor(Value *V, BasicBlock *BB,
   // If AlternativeV is not nullptr, we care about both incoming values in PHI.
   // PHI must be exactly: phi <ty> [ %BB, %V ], [ %OtherBB, %AlternativeV]
   // where OtherBB is the single other predecessor of BB's only successor.
-
-  // If V is not an instruction defined in BB, just return it.
-  if (!isa<Instruction>(V) || cast<Instruction>(V)->getParent() != BB)
-    return V;
-
   PHINode *PHI = nullptr;
   BasicBlock *Succ = BB->getSingleSuccessor();