1//===- SSAUpdater.cpp - Unstructured SSA Update Tool ----------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
--- 281 unchanged lines hidden (view full) ---
290 OldVal->replaceAllUsesWith(SingularValue);
291 else
292 OldVal->replaceAllUsesWith(UndefValue::get(InsertedVal->getType()));
293 OldVal->eraseFromParent();
294 } else {
295 InsertedVal = SingularValue;
296 }
297
298 // Either path through the 'if' should have set insertedVal -> SingularVal.
299 assert((InsertedVal == SingularValue || isa<UndefValue>(InsertedVal)) &&
300 "RAUW didn't change InsertedVal to be SingularVal");
301
302 // Drop the entries we added in IncomingPredInfo to restore the stack.
303 IncomingPredInfo.erase(IncomingPredInfo.begin()+FirstPredInfoEntry,
304 IncomingPredInfo.end());
305 return SingularValue;
306 }
307
308 // Otherwise, we do need a PHI: insert one now if we don't already have one.
309 if (InsertedVal == 0)
310 InsertedVal = PHINode::Create(PrototypeValue->getType(),
311 PrototypeValue->getName(), &BB->front());
312
313 PHINode *InsertedPHI = cast<PHINode>(InsertedVal);
--- 27 unchanged lines hidden ---
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
--- 281 unchanged lines hidden (view full) ---
290 OldVal->replaceAllUsesWith(SingularValue);
291 else
292 OldVal->replaceAllUsesWith(UndefValue::get(InsertedVal->getType()));
293 OldVal->eraseFromParent();
294 } else {
295 InsertedVal = SingularValue;
296 }
297
298 // Either path through the 'if' should have set insertedVal -> SingularVal.
299 assert((InsertedVal == SingularValue || isa<UndefValue>(InsertedVal)) &&
300 "RAUW didn't change InsertedVal to be SingularVal");
301
302 // Drop the entries we added in IncomingPredInfo to restore the stack.
303 IncomingPredInfo.erase(IncomingPredInfo.begin()+FirstPredInfoEntry,
304 IncomingPredInfo.end());
305 return SingularValue;
306 }
307
308 // Otherwise, we do need a PHI: insert one now if we don't already have one.
309 if (InsertedVal == 0)
310 InsertedVal = PHINode::Create(PrototypeValue->getType(),
311 PrototypeValue->getName(), &BB->front());
312
313 PHINode *InsertedPHI = cast<PHINode>(InsertedVal);
--- 27 unchanged lines hidden ---