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

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 02:36:45 PST 2024


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

It's definitely simpler from a code point of view, but it's also mis-leading when we print out a debug message saying "Reduced costs from 6 to 6". So I thought it made sense to simply avoid doing the work and confusing the user.

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


More information about the llvm-commits mailing list