[NARY-REASSOCIATE][NFC] Simplify min/max handling
authorEvgeniy Brevnov <ybrevnov@azul.com>
Wed, 20 Oct 2021 09:42:19 +0000 (16:42 +0700)
committerEvgeniy Brevnov <ybrevnov@azul.com>
Thu, 21 Oct 2021 08:45:53 +0000 (15:45 +0700)
commit1a8ec24efbae282f39eaacd5b22f37c2d8cad12f
treefa2abc9acff11647e0ca252a47aab717e0ff3d6b
parent36ec848dc7186b9713bb69ade134f9b2b7d65070
[NARY-REASSOCIATE][NFC] Simplify min/max handling

In order to explore different variants of reassociation current implementation uses "swap in a loop" approach. Unfortunately, the implementation is more complicated than it could be. This is an attempt to streamline the code. New approach is to extract core functionality into a helper function and call it explicitly as many times as required.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D112128
llvm/lib/Transforms/Scalar/NaryReassociate.cpp