[PATCH] D115112: [LV] Remove dead IV casts using VPlan (NFC).

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 10 02:12:39 PST 2021


fhahn marked an inline comment as done.
fhahn added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:307
+    auto &Casts = IV->getDescriptor().getCastInsts();
+    if (Casts.empty() || IV->getTruncInst())
+      continue;
----------------
Ayal wrote:
> fhahn wrote:
> > Ayal wrote:
> > > If IV has a TruncInst all of its Casts are to be retained?
> > For now, the TruncInst handling is completely separate tat the moment; If the Trunc has not been removed as dead, we will create a new (optimized) VPWidenIntOrFpInductionRecipe for the TruncInst, so there is nothing to remove here.
> It seems a bit more logical then to have "if (!IV || IV->getTruncInst()) continue", thereby indicating which recipes are (ir)relevant for this transformation.
> 
> If an IV with a TruncInst can have Casts, are their recipes removed/not-generated elsewhere? Otherwise, can we assert that there's no TruncInst after we checked that there are Casts?
Thanks, the latest version indeed doesn't really need to check the size of `Casts` any more, because it directly iterates over them, so there's nothing extra to do it empty. Adjusted!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115112/new/

https://reviews.llvm.org/D115112



More information about the llvm-commits mailing list