From 93931d78cf86168dfd24c551d0376cfac7c9c434 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Wed, 10 Nov 2021 13:03:44 +0000 Subject: [PATCH] [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. --- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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(EntryVal)) return; - const SmallVectorImpl &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.