[llvm] 93931d7 - [LV] Do not rely on InductionDescriptor::getCastInsts. (NFC)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 10 05:04:15 PST 2021


Author: Florian Hahn
Date: 2021-11-10T13:03:44Z
New Revision: 93931d78cf86168dfd24c551d0376cfac7c9c434

URL: https://github.com/llvm/llvm-project/commit/93931d78cf86168dfd24c551d0376cfac7c9c434
DIFF: https://github.com/llvm/llvm-project/commit/93931d78cf86168dfd24c551d0376cfac7c9c434.diff

LOG: [LV] Do not rely on InductionDescriptor::getCastInsts. (NFC)

Now that CastDef is passed as VPValue, there is no need to access
ID.getCastInsts, as CastDef can instead be checked.

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 bd9675f1dda5..4d1b9e22c083 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -2391,9 +2391,13 @@ void InnerLoopVectorizer::recordVectorLoopValueForInductionCast(
   if (isa<TruncInst>(EntryVal))
     return;
 
-  const SmallVectorImpl<Instruction *> &Casts = ID.getCastInsts();
-  if (Casts.empty())
+  if (!CastDef) {
+    assert(ID.getCastInsts().empty() &&
+           "there are casts for ID, but no CastDef");
     return;
+  }
+  assert(!ID.getCastInsts().empty() &&
+         "there is a CastDef, but no casts for ID");
   // Only the first Cast instruction in the Casts vector is of interest.
   // The rest of the Casts (if exist) have no uses outside the
   // induction update chain itself.


        


More information about the llvm-commits mailing list