[all-commits] [llvm/llvm-project] 675080: [SCEV] Construct SCEV iteratively.

Florian Hahn via All-commits all-commits at lists.llvm.org
Wed Jun 29 03:30:01 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 675080a4533b91b3b62e51d3659629bc020fb940
      https://github.com/llvm/llvm-project/commit/675080a4533b91b3b62e51d3659629bc020fb940
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2022-06-29 (Wed, 29 Jun 2022)

  Changed paths:
    M llvm/include/llvm/Analysis/ScalarEvolution.h
    M llvm/lib/Analysis/ScalarEvolution.cpp

  Log Message:
  -----------
  [SCEV] Construct SCEV iteratively.

This patch updates SCEV construction to work iteratively instead of recursively
in most cases. It resolves stack overflow issues when trying to construct SCEVs
for certain inputs, e.g. PR45201.

The basic approach is to to use a worklist to queue operands of V which
need to be created before V. To do so, the current patch adds a
getOperandsToCreate function which collects the operands SCEV
construction depends on for a given value. This is a slight duplication
with createSCEV.

At the moment, SCEVs for phis are still created recursively.

Fixes #32078, #42594, #44546, #49293, #49599,  #55333, #55511

Reviewed By: nikic

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




More information about the All-commits mailing list