[llvm] 9099d69 - [Vectorize] Fix a warning

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 9 10:26:55 PST 2024


Author: Kazu Hirata
Date: 2024-12-09T10:26:48-08:00
New Revision: 9099d694f6f7e84853d6add9c58a6535cdc62b3d

URL: https://github.com/llvm/llvm-project/commit/9099d694f6f7e84853d6add9c58a6535cdc62b3d
DIFF: https://github.com/llvm/llvm-project/commit/9099d694f6f7e84853d6add9c58a6535cdc62b3d.diff

LOG: [Vectorize] Fix a warning

This patch fixes:

  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:2699:49: error:
  captured structured bindings are a C++20 extension
  [-Werror,-Wc++20-extensions]

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 9d195fcb3ff78c..257fa63fcb29d8 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -2691,7 +2691,11 @@ static void addFullyUnrolledInstructionsToIgnore(
   auto *Cmp = L->getLatchCmpInst();
   if (Cmp)
     InstsToIgnore.insert(Cmp);
-  for (const auto &[IV, IndDesc] : IL) {
+  for (const auto &KV : IL) {
+    // Extract the key by hand so that it can be used in the lambda below.  Note
+    // that captured structured bindings are a C++20 extension.
+    const PHINode *IV = KV.first;
+
     // Get next iteration value of the induction variable.
     Instruction *IVInst =
         cast<Instruction>(IV->getIncomingValueForBlock(L->getLoopLatch()));


        


More information about the llvm-commits mailing list