[all-commits] [llvm/llvm-project] 8daa33: [SCEV] Avoid repeated proveNoUnsignedWrapViaInduct...

Florian Hahn via All-commits all-commits at lists.llvm.org
Thu Jul 28 02:02:45 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8daa338297d533db4d1ae8d3770613eb25c29688
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

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

  Log Message:
  [SCEV] Avoid repeated proveNoUnsignedWrapViaInduction calls.

At the moment, proveNoUnsignedWrapViaInduction may be called for the
same AddRec a large number of times via getZeroExtendExpr. This can have
a severe compile-time impact for very loop-heavy code. One one
particular workload, LSR takes ~51s without this patch, almost
exlusively in proveNoUnsignedWrapViaInduction. With this patch, the time
in LSR drops to ~0.4s.

If proveNoUnsignedWrapViaInduction failed to prove NUW the first time,
it is unlikely to succeed on subsequent tries and the cost doesn't seem
to be justified.

Besides drastically improving compile-time in some excessive cases, this
also has a slightly positive compile-time impact on CTMark:

NewPM-O3: -0.07%
NewPM-ReleaseThinLTO: -0.08%
NewPM-ReleaseLTO-g: -0.06


Reviewed By: nikic

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

More information about the All-commits mailing list