Re-apply "InstrProf: When reading, copy the data instead of taking a reference. NFC"
[oota-llvm.git] / lib / Analysis / LoopInfo.cpp
index 09045dcf8e72614337bc6af31430026e6fd3bedd..6b6faf8a66c3c6295b70b197b241da6bd77edbd1 100644 (file)
@@ -65,11 +65,7 @@ bool Loop::isLoopInvariant(const Value *V) const {
 /// hasLoopInvariantOperands - Return true if all the operands of the
 /// specified instruction are loop invariant.
 bool Loop::hasLoopInvariantOperands(const Instruction *I) const {
-  for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
-    if (!isLoopInvariant(I->getOperand(i)))
-      return false;
-
-  return true;
+  return all_of(I->operands(), [this](Value *V) { return isLoopInvariant(V); });
 }
 
 /// makeLoopInvariant - If the given value is an instruciton inside of the