Hi, Because of this "return true" not every block was visited and only one ExitBB was found (instead of two). Thus, loop was optimized as a trivial one, which was wrong. -Jakub On Nov 24, 2009, at 2:28 PM, Dan Gohman wrote:> Hello, > > I haven't studied this in detail, but at a first look this makes the > code inconsistent with the associated comments. Why should the code > continue recursing past a loop exit? > > Dan > > On Nov 23, 2009, at 4:43 AM, Jakub Staszak <kuba at gcc.gnu.org> wrote: > >> Hello, >> >> This patch fixes pr5373, testcase of course attached. >> >> -Jakub >> <5373.patch> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Hello, Simply removing that "return true" causes the code to search blocks outside of loops for side effects. That's not what the code is supposed to do. Dan On Nov 27, 2009, at 3:01 AM, Jakub Staszak wrote:> Hi, > > Because of this "return true" not every block was visited and only one ExitBB was found (instead of two). Thus, loop was optimized as a trivial one, which was wrong. > > -Jakub > > On Nov 24, 2009, at 2:28 PM, Dan Gohman wrote: > >> Hello, >> >> I haven't studied this in detail, but at a first look this makes the code inconsistent with the associated comments. Why should the code continue recursing past a loop exit? >> >> Dan >> >> On Nov 23, 2009, at 4:43 AM, Jakub Staszak <kuba at gcc.gnu.org> wrote: >> >>> Hello, >>> >>> This patch fixes pr5373, testcase of course attached. >>> >>> -Jakub >>> <5373.patch> >>> _______________________________________________ >>> LLVM Developers mailing list >>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Hello, Yeah, sorry, you are right. My new idea is that only one ExitBB is found because Header ("for.body") is already marked as visited. I'm pretty sure that someone had a good reason to do this that way, but I can't find it out :) Dan, can you look at this patch? Thanks -Jakub -------------- next part -------------- A non-text attachment was scrubbed... Name: pr5373-2.patch Type: application/octet-stream Size: 1672 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091206/0158029c/attachment.obj> -------------- next part -------------- On Nov 30, 2009, at 7:52 PM, Dan Gohman wrote:> Hello, > > Simply removing that "return true" causes the code to search > blocks outside of loops for side effects. That's not > what the code is supposed to do. > > Dan > > On Nov 27, 2009, at 3:01 AM, Jakub Staszak wrote: > >> Hi, >> >> Because of this "return true" not every block was visited and only >> one ExitBB was found (instead of two). Thus, loop was optimized as >> a trivial one, which was wrong. >> >> -Jakub >> >> On Nov 24, 2009, at 2:28 PM, Dan Gohman wrote: >> >>> Hello, >>> >>> I haven't studied this in detail, but at a first look this makes >>> the code inconsistent with the associated comments. Why should the >>> code continue recursing past a loop exit? >>> >>> Dan >>> >>> On Nov 23, 2009, at 4:43 AM, Jakub Staszak <kuba at gcc.gnu.org> wrote: >>> >>>> Hello, >>>> >>>> This patch fixes pr5373, testcase of course attached. >>>> >>>> -Jakub >>>> <5373.patch> >>>> _______________________________________________ >>>> LLVM Developers mailing list >>>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >>