diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2015-03-02 11:57:04 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2015-03-02 11:57:04 +0000 |
| commit | 8008e9f624074ac0e59642653a2a9b460fe44639 (patch) | |
| tree | 15ecf75cc8ccb57562e408ca5cb214ffa2edeba3 /llvm/lib/IR/Constants.cpp | |
| parent | 37f80456ce0d1abc10683d266695c587045439c4 (diff) | |
| download | bcm5719-llvm-8008e9f624074ac0e59642653a2a9b460fe44639.tar.gz bcm5719-llvm-8008e9f624074ac0e59642653a2a9b460fe44639.zip | |
Simplify code. NFC.
llvm-svn: 230948
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
| -rw-r--r-- | llvm/lib/IR/Constants.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index 3c6892b019f..f5d901c2cc6 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -1215,11 +1215,9 @@ ConstantExpr::getWithOperandReplaced(unsigned OpNo, Constant *Op) const { Constant *ConstantExpr::getWithOperands(ArrayRef<Constant *> Ops, Type *Ty, bool OnlyIfReduced) const { 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); Type *OnlyIfReducedTy = OnlyIfReduced ? Ty : nullptr; |

