[SLP] Recognize min/max pattern using instructions producing same values.
authorFarhana Aleen <farhana.aleen@gmail.com>
Mon, 2 Jul 2018 17:55:31 +0000 (17:55 +0000)
committerFarhana Aleen <farhana.aleen@gmail.com>
Mon, 2 Jul 2018 17:55:31 +0000 (17:55 +0000)
commit3b416db19ba91207649430cfa4604ffd331bf86c
treef59b245e92a5ed1ddabd0ed097a1d385f76756af
parent40a9f2251b75012d1d9ce8f86a834ffef9edfb0f
[SLP] Recognize min/max pattern using instructions producing same values.

Summary: It is common to have the following min/max pattern during the intermediate stages of SLP since we only optimize at the end. This patch tries to catch such patterns and allow more vectorization.

         %1 = extractelement <2 x i32> %a, i32 0
         %2 = extractelement <2 x i32> %a, i32 1
         %cond = icmp sgt i32 %1, %2
         %3 = extractelement <2 x i32> %a, i32 0
         %4 = extractelement <2 x i32> %a, i32 1
         %select = select i1 %cond, i32 %3, i32 %4

Author: FarhanaAleen

Reviewed By: ABataev, RKSimon, spatel

Differential Revision: https://reviews.llvm.org/D47608

llvm-svn: 336130
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/AMDGPU/horizontal-store.ll