[PATCH] D12073: Make ScalarEvolution::isKnownPredicate a little smarter

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 17 00:49:33 PDT 2015


To hopefully make things easier, I've attached screenshots of the diffs of the changed tests.

 -Hal

----- Original Message -----
> From: hfinkel at anl.gov
> To: hfinkel at anl.gov, sanjoy at playingwithpointers.com, atrick at apple.com
> Cc: llvm-commits at lists.llvm.org
> Sent: Monday, August 17, 2015 2:41:38 AM
> Subject: [PATCH] D12073: Make ScalarEvolution::isKnownPredicate a little smarter
> 
> hfinkel created this revision.
> hfinkel added reviewers: sanjoy, atrick.
> hfinkel added a subscriber: llvm-commits.
> hfinkel set the repository for this revision to rL LLVM.
> Herald added a subscriber: sanjoy.
> 
> First, the motivation for this patch is to allow LLVM to optimize
> this code as one might hope:
> 
>   void foo (int *a, int *b, int n) {
>     for (int i = 0; i < n; ++i) {
>       if (i > n)
>         a[i] = b[i] + 1;
>     }
>   }
> 
> As `i` is less than `n` in the loop, the conditional `(i > n)` can be
> folded to false.
> 
> With this relatively-simple change, we can perform the simplification
> in the default pipeline: indvars can perform the folding using SCEV.
> 
> Now the obvious question is: is it correct? For now, I've XFAIL'ed
> two tests:
> 
> I believe that the
> test/Transforms/IndVarSimplify/backedge-on-min-max.ll changes are
> legitimate (some of the loops in those tests are actually infinite
> loops, this change causes indvars to make that explicit instead of
> making other changes - unfortunately, I've been unable to fix the
> tests to serve their original purpose).
> 
> The test/Transforms/LoopStrengthReduce/X86/pr17473.ll changes look
> more dubious, and I'd certainly appreciate a second opinion. I'll
> attach some screen shots with the diffs.
> 
> 
> Repository:
>   rL LLVM
> 
> http://reviews.llvm.org/D12073
> 
> Files:
>   lib/Analysis/ScalarEvolution.cpp
>   test/Transforms/IndVarSimplify/backedge-on-min-max.ll
>   test/Transforms/IndVarSimplify/bec-cmp.ll
>   test/Transforms/LoopStrengthReduce/X86/pr17473.ll
> 
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
-------------- next part --------------
A non-text attachment was scrubbed...
Name: backedge-on-min-max.ll.diff.png
Type: image/png
Size: 73667 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150817/4489a078/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr17473.ll.diff.png
Type: image/png
Size: 97781 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150817/4489a078/attachment-0003.png>


More information about the llvm-commits mailing list