[all-commits] [llvm/llvm-project] dcf4b7: [SCEVExpander] Make CanonicalMode handing in isSaf...

Nikita Popov via All-commits all-commits at lists.llvm.org
Thu Jul 14 05:42:10 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dcf4b733ef8e8e876e55b85c0d67c9b32c4fde0e
      https://github.com/llvm/llvm-project/commit/dcf4b733ef8e8e876e55b85c0d67c9b32c4fde0e
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-07-14 (Thu, 14 Jul 2022)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
    M llvm/lib/CodeGen/HardwareLoops.cpp
    M llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
    M llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
    M llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
    M llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp
    M llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
    M llvm/lib/Transforms/Scalar/LoopPredication.cpp
    M llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
    M llvm/lib/Transforms/Utils/LoopUtils.cpp
    M llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
    M llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
    A llvm/test/Transforms/IndVarSimplify/pr50506.ll
    M llvm/unittests/Transforms/Utils/ScalarEvolutionExpanderTest.cpp

  Log Message:
  -----------
  [SCEVExpander] Make CanonicalMode handing in isSafeToExpand() more robust (PR50506)

isSafeToExpand() for addrecs depends on whether the SCEVExpander
will be used in CanonicalMode. At least one caller currently gets
this wrong, resulting in PR50506.

Fix this by a) making the CanonicalMode argument on the freestanding
functions required and b) adding member functions on SCEVExpander
that automatically take the SCEVExpander mode into account. We can
use the latter variant nearly everywhere, and thus make sure that
there is no chance of CanonicalMode mismatch.

Fixes https://github.com/llvm/llvm-project/issues/50506.

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




More information about the All-commits mailing list