diff options
author | Nikita Popov <npopov@redhat.com> | 2022-07-14 15:20:13 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2022-07-15 09:41:23 +0200 |
commit | f75ccadcdd87328b946e43c8e88ccf3c8188ff4f (patch) | |
tree | 0136507f275962b4edf2c7fa328e66f7acbe8cc4 /llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp | |
parent | 9510d5971eee79be481596a702bf2a3e232c30f3 (diff) | |
download | llvm-f75ccadcdd87328b946e43c8e88ccf3c8188ff4f.zip llvm-f75ccadcdd87328b946e43c8e88ccf3c8188ff4f.tar.gz llvm-f75ccadcdd87328b946e43c8e88ccf3c8188ff4f.tar.bz2 |
[LSR] Create SCEVExpander earlier, use member isSafeToExpand() (NFC)
This is a followup to D129630, which switches LSR to the member
isSafeToExpand() variant, and removes the freestanding function.
This is done by creating the SCEVExpander early (already during the
analysis phase). Because the SCEVExpander is now available for the
whole lifetime of LSRInstance, I've also made it into a member
variable, rather than passing it around in even more places.
Differential Revision: https://reviews.llvm.org/D129769
Diffstat (limited to 'llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp index 8f53787..372cd74 100644 --- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp @@ -2557,10 +2557,6 @@ Value *SCEVExpander::fixupLCSSAFormFor(Instruction *User, unsigned OpIdx) { return User->getOperand(OpIdx); } -bool SCEVExpander::isSafeToExpand(const SCEV *S) const { - return llvm::isSafeToExpand(S, SE, CanonicalMode); -} - namespace { // Search for a SCEV subexpression that is not safe to expand. Any expression // that may expand to a !isSafeToSpeculativelyExecute value is unsafe, namely @@ -2616,8 +2612,7 @@ struct SCEVFindUnsafe { }; } // namespace -namespace llvm { -bool isSafeToExpand(const SCEV *S, ScalarEvolution &SE, bool CanonicalMode) { +bool SCEVExpander::isSafeToExpand(const SCEV *S) const { SCEVFindUnsafe Search(SE, CanonicalMode); visitAll(S, Search); return !Search.IsUnsafe; @@ -2675,4 +2670,3 @@ void SCEVExpanderCleaner::cleanup() { I->eraseFromParent(); } } -} |