[all-commits] [llvm/llvm-project] 4ec4ac: [SCEVExpander] Fix addrec cost model (#106704)

Nikita Popov via All-commits all-commits at lists.llvm.org
Thu Sep 19 00:39:57 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4ec4ac15ed47ccb52d79e01c038865817d0cedf6
      https://github.com/llvm/llvm-project/commit/4ec4ac15ed47ccb52d79e01c038865817d0cedf6
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2024-09-19 (Thu, 19 Sep 2024)

  Changed paths:
    M llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
    M llvm/test/Transforms/IndVarSimplify/rewrite-loop-exit-values-phi.ll
    M llvm/test/Transforms/LoopUnroll/X86/runtime-unroll-addrec-cost.ll

  Log Message:
  -----------
  [SCEVExpander] Fix addrec cost model (#106704)

The current isHighCostExpansion cost model for addrecs computes the cost
for some kind of polynomial expansion that does not appear to have any
relation to addrec expansion whatsoever.

A literal expansion of an affine addrec is a phi and add (plus the
expansion of start and step). For a non-affine addrec, we get another
phi+add for each additional addrec nested in the step recurrence.

This partially `fixes` https://github.com/llvm/llvm-project/issues/53205
(the runtime unroll test case in this PR).



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list