[LV][IVDescriptors] Fix recurrence identity element for FMin and FMax reductions
authorKarthik Senthil <karthik.senthil@intel.com>
Fri, 4 Nov 2022 14:33:45 +0000 (10:33 -0400)
committerSanjay Patel <spatel@rotateright.com>
Fri, 4 Nov 2022 14:39:37 +0000 (10:39 -0400)
commitd9c52c31a0fee22414bb4024ee5b203fe86ef5bb
tree840708bc29242cc7b7fc116bffc782fad98cd4d2
parent710e34e1360710275662ad5b0bdc394570fb26d5
[LV][IVDescriptors] Fix recurrence identity element for FMin and FMax reductions

For a min and max reduction idioms, the identity (i.e. neutral) element
should be datatype's highest and lowest possible values respectively.
Current implementation in IVDescriptors incorrectly returns -Inf for FMin
reduction and +Inf for FMax reduction. This patch fixes this bug which
was causing incorrect reduction computation results in loops vectorized
by LV.

Differential Revision: https://reviews.llvm.org/D137220
llvm/lib/Analysis/IVDescriptors.cpp
llvm/test/Transforms/LoopVectorize/AArch64/scalable-reduction-inloop-cond.ll
llvm/test/Transforms/LoopVectorize/reduction-inloop-cond.ll
llvm/unittests/Analysis/IVDescriptorsTest.cpp