[PATCH] D152693: LoopVectorize: introduce RecurKind::Induction(I|F)(Max|Min)

Shiva Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 20 21:05:22 PDT 2023


shiva0217 added a comment.

Hi Ram,

To fix the issue mentioned in https://reviews.llvm.org/D150851#4480312,
is it possible to introduce a vector to determine the array has element equal to the initial value or not?
So the vector could be used to adjust the result if the result comes from max reduction and it smaller than the initial value.

Something like:

      Init_val = 331;
  
  Loop_header:
      AnyInitVal = {0, 0, 0, 0}
   
  Loop_body:
      ...
      last_AnyInitVal = PHI (AnyInitVal, next_AnyInitVal), 
      current_AnyInitVal = veq  current_array_vec, Init_val   // if current_array_vec is (1, 2, 331, 331) then current_AnyInitVal = (0, 0, 1, 1)
      next_AnyInitVal = vor  current_AnyInitVal, last_AnyInitVal;
      ...
  Loop Exit:
  
      if (result_come_from_max_reduction)
         if ((max_reduction < InitVal) && (next_AnyInitVal has non-zero element))
            return InitVal;
         else return max_reduction;


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152693



More information about the llvm-commits mailing list