|
@@ -2674,7 +2674,7 @@ public:
|
|
}
|
|
}
|
|
|
|
|
|
/// Replace every incoming basic block \p Old to basic block \p New.
|
|
/// Replace every incoming basic block \p Old to basic block \p New.
|
|
- void replaceIncomingBlockWith(BasicBlock *Old, BasicBlock *New) {
|
|
|
|
|
|
+ void replaceIncomingBlockWith(const BasicBlock *Old, BasicBlock *New) {
|
|
assert(New && Old && "PHI node got a null basic block!");
|
|
assert(New && Old && "PHI node got a null basic block!");
|
|
for (unsigned Op = 0, NumOps = getNumOperands(); Op != NumOps; ++Op)
|
|
for (unsigned Op = 0, NumOps = getNumOperands(); Op != NumOps; ++Op)
|
|
if (getIncomingBlock(Op) == Old)
|
|
if (getIncomingBlock(Op) == Old)
|
|
@@ -2724,6 +2724,18 @@ public:
|
|
return getIncomingValue(Idx);
|
|
return getIncomingValue(Idx);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /// Set every incoming value(s) for block \p BB to \p V.
|
|
|
|
+ void setIncomingValueForBlock(const BasicBlock *BB, Value *V) {
|
|
|
|
+ assert(BB && "PHI node got a null basic block!");
|
|
|
|
+ bool Found = false;
|
|
|
|
+ for (unsigned Op = 0, NumOps = getNumOperands(); Op != NumOps; ++Op)
|
|
|
|
+ if (getIncomingBlock(Op) == BB) {
|
|
|
|
+ Found = true;
|
|
|
|
+ setIncomingValue(Op, V);
|
|
|
|
+ }
|
|
|
|
+ assert(Found && "Invalid basic block argument to set!");
|
|
|
|
+ }
|
|
|
|
+
|
|
/// If the specified PHI node always merges together the
|
|
/// If the specified PHI node always merges together the
|
|
/// same value, return the value, otherwise return null.
|
|
/// same value, return the value, otherwise return null.
|
|
Value *hasConstantValue() const;
|
|
Value *hasConstantValue() const;
|