diff options
author | Philip Reames <listmail@philipreames.com> | 2020-10-28 14:29:03 -0700 |
---|---|---|
committer | Philip Reames <listmail@philipreames.com> | 2020-10-28 14:33:30 -0700 |
commit | 4e4abd16a74d432e29c27cc68b0493e46f679a91 (patch) | |
tree | 04c7adf9172e931c08593a356217b0cd947076ed /llvm/lib/Analysis/Loads.cpp | |
parent | 09abecef7bbfda18d34f046954eaa4d491062839 (diff) | |
download | llvm-4e4abd16a74d432e29c27cc68b0493e46f679a91.zip llvm-4e4abd16a74d432e29c27cc68b0493e46f679a91.tar.gz llvm-4e4abd16a74d432e29c27cc68b0493e46f679a91.tar.bz2 |
[Deref] Use maximum trip count instead of exact trip count
When trying to prove that a memory access touches only dereferenceable memory across all iterations of a loop, use the maximum exit count rather than an exact one. In many cases we can't prove exact exit counts whereas we can prove an upper bound.
The test included is for a single exit loop with a min(C,V) exit count, but the true motivation is support for multiple exits loops. It's just really hard to write a test case for multiple exits because the vectorizer (the primary user of this API), bails far before this. For multiple exits, this allows a mix of analyzeable and unanalyzable exits when only analyzeable exits are needed to prove deref.
Diffstat (limited to 'llvm/lib/Analysis/Loads.cpp')
-rw-r--r-- | llvm/lib/Analysis/Loads.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/Loads.cpp b/llvm/lib/Analysis/Loads.cpp index 5ca5384..2ca35a4 100644 --- a/llvm/lib/Analysis/Loads.cpp +++ b/llvm/lib/Analysis/Loads.cpp @@ -222,9 +222,7 @@ bool llvm::isDereferenceableAndAlignedInLoop(LoadInst *LI, Loop *L, if (Step->getAPInt() != EltSize) return false; - // TODO: If the symbolic trip count has a small bound (max count), we might - // be able to prove safety. - auto TC = SE.getSmallConstantTripCount(L); + auto TC = SE.getSmallConstantMaxTripCount(L); if (!TC) return false; |