[llvm-branch-commits] [llvm] [LoopVectorize][NFC] Refactor widening decision logic (PR #140722)

David Sherwood via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Nov 10 04:58:29 PST 2025


================
@@ -1240,9 +1240,10 @@ class LoopVectorizationCostModel {
   getDivRemSpeculationCost(Instruction *I,
                            ElementCount VF) const;
 
-  /// Returns true if \p I is a memory instruction with consecutive memory
-  /// access that can be widened.
-  bool memoryInstructionCanBeWidened(Instruction *I, ElementCount VF);
+  /// Returns widening decision (CM_Widen or CM_Widen_Reverse) if \p I is a
+  /// memory instruction with consecutive access that can be widened, or
+  /// CM_Unknown otherwise.
+  InstWidening memoryInstructionCanBeWidened(Instruction *I, ElementCount VF);
----------------
david-arm wrote:

This is just a suggestion, but given this function is only called from one place - getConsecutiveMemOpCost - I wonder if it's worth deleting and simply moving the logic directly into getConsecutiveMemOpCost?

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


More information about the llvm-branch-commits mailing list