[llvm] [LoopVectorize] Don't discount instructions scalarized due to tail folding (PR #109289)
John Brawn via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 30 08:41:56 PDT 2024
================
@@ -21,7 +21,31 @@ define void @foo(ptr noalias %a, ptr noalias %b, ptr noalias %c, i64 %N) {
; CHECK-NEXT: vector.body:
; CHECK-NEXT: EMIT vp<[[CAN_IV:%.+]]> = CANONICAL-INDUCTION ir<0>, vp<[[CAN_INC:%.*]]>
; CHECK-NEXT: WIDEN-INDUCTION %iv = phi 0, %iv.next, ir<1>, vp<[[VF]]>
+; CHECK-NEXT: vp<[[STEPS:%.+]]> = SCALAR-STEPS vp<[[CAN_IV]]>, ir<1>
; CHECK-NEXT: EMIT vp<[[CMP:%.+]]> = icmp ule ir<%iv>, vp<[[BTC]]>
+; CHECK-NEXT: Successor(s): pred.load
----------------
john-brawn-arm wrote:
This test is a bit strange as both before and after this patch this VPlan isn't used, as it decides the scalar version costs less. As to why it decides this VPlan is the best for this vector length, computePredInstDiscount doesn't currently account for any control flow instructions it could be able to remove by scalarizing everything, though I don't know how it would do that, as it's making a decision about whether to scalarize the chain of instructions feeding into a store, and the chose to scalarize the loads happens elsewhere.
https://github.com/llvm/llvm-project/pull/109289
More information about the llvm-commits
mailing list