[PATCH] D105632: [LV] Use lookThroughAnd with logical reductions

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 8 08:47:34 PDT 2021


david-arm added a comment.

A nice patch! Good to see more vectorisation capability and code improvements here. Before I accept the patch it might be worth seeing what others think about the inloop tests?



================
Comment at: llvm/test/Transforms/LoopVectorize/reduction-inloop-pred.ll:1598
+; CHECK-NEXT:    [[TMP32:%.*]] = trunc <4 x i32> [[TMP31]] to <4 x i8>
+; CHECK-NEXT:    [[TMP33:%.*]] = call i8 @llvm.vector.reduce.and.v4i8(<4 x i8> [[TMP32]])
 ; CHECK-NEXT:    br i1 true, label [[DOT_CRIT_EDGE:%.*]], label [[SCALAR_PH]]
----------------
Given the reduction intrinsic is no longer in the loop is it worth moving this to a different file? Any thoughts @dmgreen @spatel?


================
Comment at: llvm/test/Transforms/LoopVectorize/reduction-inloop.ll:1065
 ; CHECK:       middle.block:
+; CHECK-NEXT:    [[TMP5:%.*]] = call i8 @llvm.vector.reduce.and.v4i8(<4 x i8> [[TMP3]])
 ; CHECK-NEXT:    br i1 true, label [[DOT_CRIT_EDGE:%.*]], label [[SCALAR_PH]]
----------------
Same comment as in `reduction-inloop-pred.ll`.


================
Comment at: llvm/test/Transforms/LoopVectorize/trunc-reductions.ll:119
+; CHECK-NEXT:    [[INDEX:%.*]] = phi i32 [ 0, %vector.ph ], [ [[INDEX_NEXT:%.*]], %vector.body ]
+; CHECK-NEXT:    [[VEC_PHI:%.*]] = phi <8 x i32> [ <i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255>, %vector.ph ], [ [[TMP5:%.*]], %vector.body ]
+; CHECK-NEXT:    [[TMP0:%.*]] = sext i32 [[INDEX]] to i64
----------------
This phi instruction hasn't been narrowed like it has for the cases above, but at least we do now vectorise this loop! Perhaps this is something for a future investigation?


================
Comment at: llvm/test/Transforms/LoopVectorize/trunc-reductions.ll:197
+
+!0 = distinct !{!0, !1, !2, !3}
+!1 = !{!"llvm.loop.vectorize.width", i32 8}
----------------
nit: Is it worth removing the loop hints and just specifying `-force-vector-interleave=1 -force-vector-width=8` on the RUN line?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105632



More information about the llvm-commits mailing list