[PATCH] D153936: [LV] Add tests for select-cmp reduction pattern. (NFC)

Mel Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 10 22:53:45 PDT 2023


Mel-Chen added inline comments.


================
Comment at: llvm/test/Transforms/LoopVectorize/iv-select-cmp-no-wrap.ll:11
+for.body:                                         ; preds = %entry, %for.body
+  %i.010 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
+  %idx.09 = phi i64 [ %cond, %for.body ], [ %ii, %entry ]
----------------
fhahn wrote:
> Should we also have tests with different induction start values (constant and variable)? Would be good to adjust the name of the phis to make clearer what's the induction and what's the select reduction.
> 
> nit: personally I find it easier to read if the incoming value from the preheader comes first.
Sure. I will add a new test case into `iv-select-cmp.ll`, and it will be a negative case for D150851.


================
Comment at: llvm/test/Transforms/LoopVectorize/iv-select-cmp.ll:27
+
+define i64 @select_icmp_const_2(ptr nocapture readonly %a, i64 %n) {
+; CHECK-LABEL: define i64 @select_icmp_const_2
----------------
fhahn wrote:
> What does `_const_2` stand for here?
There is no special meaning. `_const` is only used to indicate that the value is compared to a constant, and `_2` is just a serial number indicating they are similar tests. The difference between `const_2` and `const_1` is `%cond = select i1 %cmp2, i64 %idx.09, i64 %i.010`, while the difference between `const_3` and `const_1` is `%idx.09 = phi i64 [ %cond, %for.body ], [ %ii, %entry ]`.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153936



More information about the llvm-commits mailing list