[PATCH] D129630: [SCEVExpander] Make CanonicalMode handing in isSafeToExpand() more robust (PR50506)

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 03:30:00 PDT 2022


nikic created this revision.
nikic added reviewers: reames, fhahn, mkazantsev.
Herald added subscribers: javed.absar, kbarton, hiraditya, nemanjai.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


https://reviews.llvm.org/D129630

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129630.444203.patch
Type: text/x-patch
Size: 17568 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220713/6ab4d53a/attachment.bin>


More information about the llvm-commits mailing list