Hongbin Zheng via llvm-dev
2017-Jul-24 21:16 UTC
[llvm-dev] LazyValueInfo vs ScalarEvolution
Thanks, maybe we could use ScalarEvolution in LazyValueInfo if it is available? On Mon, Jul 24, 2017 at 1:44 PM, John Regehr via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Since they are different static analyses there's no reason to expect them > to agree, but they should both be conservative. In other words, if you like > you can compute the intersection of the two ConstantRanges and the result > should still be an overapproximation of the values that will occur at run > time. > > John > > > > > On 07/24/2017 02:34 PM, Hongbin Zheng via llvm-dev wrote: > >> Hi, >> >> Both LazyValueInfo and ScalarEvolution can calculate a constant range for >> an LLVM Value. >> I found that some times they do not agree, may be I interpreted them >> incorrectly >> >> For example in the following IR: >> >> bb85: ; preds = %bb85, %bb73 >> %tmp86 = phi i32 [ 1, %bb73 ], [ %tmp95, %bb85 ] >> %tmp95 = add nsw i32 %tmp86, 1 >> %tmp96 = icmp slt i32 %tmp95, 20 >> br i1 %tmp96, label %bb85, label %bb97 >> >> LazyValueInfo give: >> >> POP %tmp86 = phi i32 [ 1, %bb73 ], [ %tmp95, %bb85 ] in bb85 >> constantrange<-2147483648, 20> >> >> While ScalarEvolution give: >> >> %tmp86 = phi i32 [ 1, %bb73 ], [ %tmp95, %bb85 ] >> --> {1,+,1}<nuw><nsw><%bb85> U: [1,20) S: [1,20) Exits: >> 19 LoopDispositions: { %bb85: Computable, %bb73: Variant, >> %bb46: Variant } >> >> In this example, the range of %tmp86 is <-2147483648, 20> from >> LazyValueInfo, but it is [1,20) from ScalarEvolution. >> >> How can I interpret these results? >> Is there a way to get [0, 20) for %tmp86 in LazyValueInfo? >> >> Thanks >> Hongbin >> >> >> >> >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >> _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170724/09139703/attachment.html>
John Regehr via llvm-dev
2017-Jul-24 21:29 UTC
[llvm-dev] LazyValueInfo vs ScalarEvolution
On 7/24/17 3:16 PM, Hongbin Zheng via llvm-dev wrote:> Thanks, maybe we could use ScalarEvolution in LazyValueInfo if it is > available?This should be fairly easy to try, if you want to propose a patch and run some experiments. The question is whether the benefit in terms of improved optimization power is worth the compile-time cost. Also, the last time I looked, there seemed to be a fair amount of room for improvement in LVI and ConstantRange. John
Hongbin Zheng via llvm-dev
2017-Jul-24 21:43 UTC
[llvm-dev] LazyValueInfo vs ScalarEvolution
On Mon, Jul 24, 2017 at 2:29 PM, John Regehr via llvm-dev < llvm-dev at lists.llvm.org> wrote:> On 7/24/17 3:16 PM, Hongbin Zheng via llvm-dev wrote: > >> Thanks, maybe we could use ScalarEvolution in LazyValueInfo if it is >> available? >> > > This should be fairly easy to try, if you want to propose a patch and run > some experiments. The question is whether the benefit in terms of improved > optimization power is worth the compile-time cost.Ok Also, the last time I looked, there seemed to be a fair amount of room for> improvement in LVI and ConstantRange.Could you point some out? Thanks Hongbin> > > John > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170724/c7446461/attachment.html>