[all-commits] [llvm/llvm-project] 269f56: [NARY-REASSOCIATE] Fix infinite recursion optimizi...

ebrevnov via All-commits all-commits at lists.llvm.org
Wed Oct 20 00:23:17 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 269f563a2bcd88eba3fd4c25669713e64ab06f03
      https://github.com/llvm/llvm-project/commit/269f563a2bcd88eba3fd4c25669713e64ab06f03
  Author: Evgeniy Brevnov <ybrevnov at azul.com>
  Date:   2021-10-20 (Wed, 20 Oct 2021)

  Changed paths:
    M llvm/lib/Transforms/Scalar/NaryReassociate.cpp
    M llvm/test/Transforms/NaryReassociate/nary-req.ll

  Log Message:
  -----------
  [NARY-REASSOCIATE] Fix infinite recursion optimizing min\max

To guarantee convergence of the algorithm each optimization step should decrease number of instructions when IR is modified. This property is not held in this test case. The problem is that SCEV Expander may do "unexpected" reassociation what results in creation of new min/max chains and introduction of extra instructions. As a result on each step we indefinitely optimize back and forth.

The solution is to restrict SCEV Expander to perform uncontrolled reassociations by means of "Unknown" expressions.

Reviewed By: nikic

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




More information about the All-commits mailing list