[LoopVectorizer] Silence warning in GetRegUsage.
authorSander de Smalen <sander.desmalen@arm.com>
Wed, 11 Nov 2020 10:45:28 +0000 (10:45 +0000)
committerSander de Smalen <sander.desmalen@arm.com>
Wed, 11 Nov 2020 10:54:20 +0000 (10:54 +0000)
This patch silences the warning:
error: lambda capture 'DL' is not used [-Werror,-Wunused-lambda-capture]
  auto GetRegUsage = [&DL, &TTI=TTI](Type *Ty, ElementCount VF) {
                      ~^~~
1 error generated.

Introduced in:
  https://reviews.llvm.org/rGb873aba3943c067a5efd5303cbdf5aeb0732cf88

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

index 5d50dce..527f38a 100644 (file)
@@ -5793,7 +5793,6 @@ LoopVectorizationCostModel::calculateRegisterUsage(ArrayRef<ElementCount> VFs) {
   unsigned MaxSafeDepDist = -1U;
   if (Legal->getMaxSafeDepDistBytes() != -1U)
     MaxSafeDepDist = Legal->getMaxSafeDepDistBytes() * 8;
-  const DataLayout &DL = TheFunction->getParent()->getDataLayout();
 
   SmallVector<RegisterUsage, 8> RUs(VFs.size());
   SmallVector<SmallMapVector<unsigned, unsigned, 4>, 8> MaxUsages(VFs.size());
@@ -5801,7 +5800,7 @@ LoopVectorizationCostModel::calculateRegisterUsage(ArrayRef<ElementCount> VFs) {
   LLVM_DEBUG(dbgs() << "LV(REG): Calculating max register usage:\n");
 
   // A lambda that gets the register usage for the given type and VF.
-  auto GetRegUsage = [&DL, &TTI=TTI](Type *Ty, ElementCount VF) {
+  auto GetRegUsage = [&TTI=TTI](Type *Ty, ElementCount VF) {
     if (Ty->isTokenTy())
       return 0U;
     return TTI.getRegUsageForType(VectorType::get(Ty, VF));