[Deref] Use maximum trip count instead of exact trip count
authorPhilip Reames <listmail@philipreames.com>
Wed, 28 Oct 2020 21:29:03 +0000 (14:29 -0700)
committerPhilip Reames <listmail@philipreames.com>
Wed, 28 Oct 2020 21:33:30 +0000 (14:33 -0700)
commit4e4abd16a74d432e29c27cc68b0493e46f679a91
tree04c7adf9172e931c08593a356217b0cd947076ed
parent09abecef7bbfda18d34f046954eaa4d491062839
[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.
llvm/lib/Analysis/Loads.cpp
llvm/test/Transforms/LoopVectorize/X86/load-deref-pred.ll