diff options
author | Florian Hahn <flo@fhahn.com> | 2025-09-02 13:49:09 +0100 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2025-09-02 13:49:22 +0100 |
commit | 9a1e47839a331be303cb5b8ec034bfa53cc30f8a (patch) | |
tree | e07cf7259b260e2010080808400bb26956ef5092 /llvm/lib/Analysis/Loads.cpp | |
parent | a65aa32a3bf153204ff51c23d432a2497533a656 (diff) | |
download | llvm-9a1e47839a331be303cb5b8ec034bfa53cc30f8a.zip llvm-9a1e47839a331be303cb5b8ec034bfa53cc30f8a.tar.gz llvm-9a1e47839a331be303cb5b8ec034bfa53cc30f8a.tar.bz2 |
[Loads] Apply loop guards to maximum pointer difference.
Applying loop guards to MaxPtrDiff can improve results in some cases.
Diffstat (limited to 'llvm/lib/Analysis/Loads.cpp')
-rw-r--r-- | llvm/lib/Analysis/Loads.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/Loads.cpp b/llvm/lib/Analysis/Loads.cpp index 58f559a..8415158 100644 --- a/llvm/lib/Analysis/Loads.cpp +++ b/llvm/lib/Analysis/Loads.cpp @@ -355,7 +355,10 @@ bool llvm::isDereferenceableAndAlignedInLoop( const SCEV *PtrDiff = SE.getMinusSCEV(AccessEnd, AccessStart); if (isa<SCEVCouldNotCompute>(PtrDiff)) return false; - APInt MaxPtrDiff = SE.getUnsignedRangeMax(PtrDiff); + ScalarEvolution::LoopGuards LoopGuards = + ScalarEvolution::LoopGuards::collect(AddRec->getLoop(), SE); + APInt MaxPtrDiff = + SE.getUnsignedRangeMax(SE.applyLoopGuards(PtrDiff, LoopGuards)); Value *Base = nullptr; APInt AccessSize; |