1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

Simplify code. NFC.

llvm-svn: 230948
This commit is contained in:
Benjamin Kramer 2015-03-02 11:57:04 +00:00
parent eaf4cde743
commit 95a7c55022
2 changed files with 5 additions and 15 deletions

View File

@ -5418,17 +5418,9 @@ UpdateNodeOperands(SDNode *N, ArrayRef<SDValue> Ops) {
assert(N->getNumOperands() == NumOps && assert(N->getNumOperands() == NumOps &&
"Update with wrong number of operands"); "Update with wrong number of operands");
// Check to see if there is no change. // If no operands changed just return the input node.
bool AnyChange = false; if (std::equal(Ops.begin(), Ops.end(), N->op_begin()))
for (unsigned i = 0; i != NumOps; ++i) { return N;
if (Ops[i] != N->getOperand(i)) {
AnyChange = true;
break;
}
}
// No operands changed, just return the input node.
if (!AnyChange) return N;
// See if the modified node already exists. // See if the modified node already exists.
void *InsertPos = nullptr; void *InsertPos = nullptr;

View File

@ -1215,11 +1215,9 @@ ConstantExpr::getWithOperandReplaced(unsigned OpNo, Constant *Op) const {
Constant *ConstantExpr::getWithOperands(ArrayRef<Constant *> Ops, Type *Ty, Constant *ConstantExpr::getWithOperands(ArrayRef<Constant *> Ops, Type *Ty,
bool OnlyIfReduced) const { bool OnlyIfReduced) const {
assert(Ops.size() == getNumOperands() && "Operand count mismatch!"); assert(Ops.size() == getNumOperands() && "Operand count mismatch!");
bool AnyChange = Ty != getType();
for (unsigned i = 0; i != Ops.size(); ++i)
AnyChange |= Ops[i] != getOperand(i);
if (!AnyChange) // No operands changed, return self. // If no operands changed return self.
if (Ty == getType() && std::equal(Ops.begin(), Ops.end(), op_begin()))
return const_cast<ConstantExpr*>(this); return const_cast<ConstantExpr*>(this);
Type *OnlyIfReducedTy = OnlyIfReduced ? Ty : nullptr; Type *OnlyIfReducedTy = OnlyIfReduced ? Ty : nullptr;