On 02.11.2012, at 15:53, Preston Briggs <preston.briggs at gmail.com> wrote:> Hi Chandler, > > Thanks for writing. > Could you give me some C (or C++) for an illustrative example. > I think I understand your concern, but I'd like to be sure.Hi Preston, The bug report at http://llvm.org/bugs/show_bug.cgi?id=14241 has more details, including a C++ test case. - Ben
I see, thanks Ben. So yes, I certainly misunderstood (more likely "misunderstand") how things work. My initial guess is that a conservative fix is quick and small (make sure the underlying pointers are loop invariant, otherwise give up). A better approach would be to somehow turn code like the example into array references that can be analyzed. I'll need to think about this and do some reading. Regarding testing... I wrote it the way I did to allow me to focus on particular tests without being distracted by the n^2 explosion resulting from testing everything against everything. But I can see the problem of not being able to handle arbitrary test cases that come from real examples, so I guess it'll need to be changed. Thanks for your efforts, Preston -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121102/6d16167b/attachment.html>
On 11/02/2012 10:21 AM, Preston Briggs wrote:> > My initial guess is that a conservative fix is quick and small (make > sure the underlying pointers are loop invariant, otherwise give up). A > better approach would be to somehow turn code like the example into > array references that can be analyzed. I'll need to think about this and > do some reading.Hi Preston, I looked at this test case. I am not sure what you are exactly doing, but I have the feeling you start from the getelementptr instruction. If you directly pass the pointer that is pointed to by the loads and stores to SCEV, there should just be a single base pointer %s in the resulting SCEVS. You can then extract this base pointer, subtract it from the scev and analyze the remaining scev as subscript. The base pointer in this test case is loop invariant. Cheers Tobi