[llvm] [LoopVectorize] Fix divide-by-zero bug (#80836) (PR #81721)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 02:34:33 PST 2024


================
@@ -2106,18 +2106,20 @@ class GeneratedRTChecks {
               BestTripCount = *EstimatedTC;
           }
 
-          InstructionCost NewMemCheckCost = MemCheckCost / BestTripCount;
+          if (BestTripCount > 1) {
----------------
fhahn wrote:

Simpler to just force `BestTripCount` to be at least one using `std::max`?

https://github.com/llvm/llvm-project/pull/81721


More information about the llvm-commits mailing list