[llvm-commits] [llvm] r155884 - in /llvm/trunk: lib/Transforms/Scalar/LICM.cpp test/Transforms/LICM/speculate.ll

Nick Lewycky nlewycky at google.com
Wed May 23 11:08:46 PDT 2012


On 23 May 2012 08:29, Evan Cheng <evan.cheng at apple.com> wrote:

> Has this been fixed?
>

Nope.

Evan
>
> On Apr 30, 2012, at 10:37 PM, Nick Lewycky <nicholas at mxc.ca> wrote:
>
> > Eli Friedman wrote:
> >> On Mon, Apr 30, 2012 at 9:03 PM, Nick Lewycky<nicholas at mxc.ca>  wrote:
> >>> Author: nicholas
> >>> Date: Mon Apr 30 23:03:01 2012
> >>> New Revision: 155884
> >>>
> >>> URL: http://llvm.org/viewvc/llvm-project?rev=155884&view=rev
> >>> Log:
> >>> An instruction in a loop is not guaranteed to be executed just because
> the loop
> >>> has no exit blocks. Fixes PR12706!
> >>>
> >>> Modified:
> >>>    llvm/trunk/lib/Transforms/Scalar/LICM.cpp
> >>>    llvm/trunk/test/Transforms/LICM/speculate.ll
> >>>
> >>> Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
> >>> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=155884&r1=155883&r2=155884&view=diff
> >>>
> ==============================================================================
> >>> --- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
> >>> +++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Mon Apr 30 23:03:01 2012
> >>> @@ -618,6 +618,11 @@
> >>>     if (!DT->dominates(Inst.getParent(), ExitBlocks[i]))
> >>>       return false;
> >>>
> >>> +  // As a degenerate case, if the loop is statically infinite then we
> haven't
> >>> +  // proven anything since there are no exit blocks.
> >>> +  if (ExitBlocks.empty())
> >>> +    return false;
> >>
> >> Even if there are exit blocks, you still haven't proven anything; take
> >> something like the following, assuming the compiler doesn't know
> >> anything about exit():
> >>
> >> int f(int x, int y) {
> >>   int n = 0;
> >>   for (int i = 0; i<  10; i++) {
> >>     exit(0);
> >>     n += x / (y+i);
> >>   }
> >>   return n;
> >> }
> >
> > Great point Eli. I was struggling with a different aspect of its design
> > (why use exit blocks vs. exiting blocks) but missed this bug. I don't
> > have the time to fix it, so I'd appreciate it if you want to take over!
> >
> > Nick
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120523/808beba0/attachment.html>


More information about the llvm-commits mailing list