[PATCH] D147720: [LV] Use the known trip count when costing non-tail folded VFs

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 21 05:53:44 PDT 2023


dmgreen added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:5368
+    auto RTCostA =
+        A.Width.getFixedValue()
+            ? (CostA * divideCeil(MaxTripCount, A.Width.getFixedValue()))
----------------
david-arm wrote:
> Hi @dmgreen, perhaps I've missed something here but it looks like there is a divide-by-zero in the code?
> 
> If `A.Width.getFixedValue()` is non-zero then we calculate `(CostA * divideCeil(MaxTripCount, A.Width.getFixedValue()))`, and if it is zero then we do `(CostA * (MaxTripCount / A.Width.getFixedValue()) + ...`
> 
> 
Oh yeah, that was wrong. It was meant to be based on foldTailByMasking. That must have been confusing. I've reran the testing and it still looks OK, this patch doesnt usually alter a lot.


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

https://reviews.llvm.org/D147720



More information about the llvm-commits mailing list