Use v.data() instead of &v[0] when SmallVector v might be empty.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72210 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp
index 00b5441..e5ab322 100644
--- a/lib/Analysis/ConstantFolding.cpp
+++ b/lib/Analysis/ConstantFolding.cpp
@@ -260,7 +260,7 @@
}
}
- return ConstantVector::get(&Result[0], Result.size());
+ return ConstantVector::get(Result.data(), Result.size());
}
}
@@ -306,10 +306,10 @@
if (const CmpInst *CI = dyn_cast<CmpInst>(I))
return ConstantFoldCompareInstOperands(CI->getPredicate(),
- &Ops[0], Ops.size(), TD);
+ Ops.data(), Ops.size(), TD);
else
return ConstantFoldInstOperands(I->getOpcode(), I->getType(),
- &Ops[0], Ops.size(), TD);
+ Ops.data(), Ops.size(), TD);
}
/// ConstantFoldConstantExpression - Attempt to fold the constant expression
@@ -325,10 +325,10 @@
if (CE->isCompare())
return ConstantFoldCompareInstOperands(CE->getPredicate(),
- &Ops[0], Ops.size(), TD);
+ Ops.data(), Ops.size(), TD);
else
return ConstantFoldInstOperands(CE->getOpcode(), CE->getType(),
- &Ops[0], Ops.size(), TD);
+ Ops.data(), Ops.size(), TD);
}
/// ConstantFoldInstOperands - Attempt to constant fold an instruction with the