[all-commits] [llvm/llvm-project] 5dad4c: [SCEV] Iteratively compute ranges for deeply neste...

Florian Hahn via All-commits all-commits at lists.llvm.org
Mon Nov 21 13:58:15 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5dad4c67882a5eac2485f722e8e4109642155058
      https://github.com/llvm/llvm-project/commit/5dad4c67882a5eac2485f722e8e4109642155058
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2022-11-21 (Mon, 21 Nov 2022)

  Changed paths:
    M llvm/include/llvm/Analysis/ScalarEvolution.h
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/test/Analysis/ScalarEvolution/ranges.ll
    A llvm/test/Transforms/IndVarSimplify/range-iter-threshold.ll

  Log Message:
  -----------
  [SCEV] Iteratively compute ranges for deeply nested expressions.

At the moment, getRangeRef may overflow the stack for very deeply nested
expressions.

This patch introduces a new getRangeRefIter function, which first builds
a worklist of N-ary expressions and phi nodes, followed by their
operands iteratively.

getRangeRef has been extended to also take a Depth argument and it
switches to use getRangeRefIter once the depth reaches a certain
threshold.

This ensures compile-time is not impacted in general. Note that
the iterative algorithm may lead to a slightly different evaluation
order, which could result in slightly worse ranges for cyclic phis.

https://llvm-compile-time-tracker.com/compare.php?from=23c3eb7cdf3478c9db86f6cb5115821a8f0f5f40&to=e0e09fa338e77e53242bfc846e1484350ad79773&stat=instructions

Fixes #49579.

Reviewed By: mkazantsev

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




More information about the All-commits mailing list