[all-commits] [llvm/llvm-project] f5f421: [SCEV] Apply loop guards in reverse order.

Florian Hahn via All-commits all-commits at lists.llvm.org
Thu Dec 16 02:53:23 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f5f421e0eefa492545c3848e318c21ed04cb1ddd
      https://github.com/llvm/llvm-project/commit/f5f421e0eefa492545c3848e318c21ed04cb1ddd
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2021-12-16 (Thu, 16 Dec 2021)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll

  Log Message:
  -----------
  [SCEV] Apply loop guards in reverse order.

This patch updates applyLoopGuards to first collect all conditions and
then applies them in reverse order. This ensures the SCEVs with the
shortest dependency chains are constructed first, limiting the required
stack size.

This fixes a crash reported in D113578.

Note that the order conditions are applied can impact the accuracy of
the result, mostly due to missing min/max simplifications when
constructing SCEVs.

The changed test highlights the impact of the evaluation order. I will
follow up with a SCEV patch to improve min/max simplifications to get
the same results for both orders.




More information about the All-commits mailing list