[LLVMdev] Fwd: Improper Function::iterator increment

Pranav Kant pranav913 at gmail.com
Tue Feb 10 01:26:24 PST 2015


Sorry but that didn't make any difference. Loop is still infinite.

On Tue, Feb 10, 2015 at 2:47 PM, Nick Lewycky <nicholas at mxc.ca> wrote:

> This is a bit of a long shot, but your loop looks fine, and I noticed a
> bug in one of the functions you call from your loop body. Try this for
> WaveScalar::setLabel:
>
> -     Twine twine(k);
> -     (*succ)->setName(twine);
> +     (*succ)->setName(Twine(k));
>
> and see whether that makes any difference?
>
> Nick
>
> Pranav Kant wrote:
>
>> Input to this pass is the bitcode format of simple code below :
>>
>> int sum_single_loop (int a){
>>     int su = 0, i;
>>     for (i=0;i<a;i++)
>>        su = su + i;
>>     return su;
>> }
>>
>>
>> On Mon, Feb 9, 2015 at 2:32 AM, David Blaikie <dblaikie at gmail.com
>> <mailto:dblaikie at gmail.com>> wrote:
>>
>>
>>
>>     On Sun, Feb 8, 2015 at 11:23 AM, Pranav Kant <pranav913 at gmail.com
>>     <mailto:pranav913 at gmail.com>> wrote:
>>
>>         So, you mean to say that the above implementation is correct and
>>         should work fine.
>>
>>
>>     So far as I can see - but I could be missing something.
>>
>>         I initially thought that the above way is not the correct way
>>         anymore since 3.5.0 might have changed few things.
>>
>>         Anyways here is my dirty code I have written for my research
>>         project that I took the above snippet from :
>>
>>         https://github.com/pranavk/spatial-computing/blob/master/
>> waves.cpp#L105
>>
>>
>>     Someone (not necessarily me) will presumably need the
>>     input/command/arguments/whatever required to trigger the infinite
>>     loop in this code that you're seeing, as well as the code there.
>>
>>
>>
>>
>>         On Sun, Feb 8, 2015 at 10:25 PM, David Blaikie
>>         <dblaikie at gmail.com <mailto:dblaikie at gmail.com>> wrote:
>>
>>             This may be difficult yo reproduce or debug without a more
>>             complete (though preferably minimal) test case.
>>
>>             On Feb 8, 2015 8:31 AM, "Pranav Kant" <pranav913 at gmail.com
>>             <mailto:pranav913 at gmail.com>> wrote:
>>
>>                 void Wave::init (const Function &F){
>>                      Function::const_iterator ie = F.end();
>>                      outs() << ie << "\n\n";
>>                      for (Function::const_iterator I = F.begin(), IE =
>>                 F.end(); I != IE; I++, K++){
>>                         outs() << I << "\n";
>>                         // some manipulation with I
>>                      }
>>                 }
>>
>>                 I used the above shown function in my pass in LLVM 3.4.2
>>                 and it used to work fine but when I am compiling this
>>                 pass with 3.5.0, this is a never ending loop. Can
>>                 someone please suggest me what can be wrong here ?
>>
>>                 Upon some debugging, I found out that const_iterator I
>>                 never becomes equal to IE, rather it goes past IE when
>>                 incremented and hence loop never ends.
>>
>>                 Following is the output upon executing above code.
>>
>>                 0x2e08248 <- address of ie
>>                 0x2e16630 <- address of I initially
>>                 0x2e08250 <- incremented I
>>                 0x2e165e0
>>                 0x2e16630
>>                 0x2e08250
>>                 0x2e165e0
>>                 0x2e16630
>>                 0x2e08250
>>
>>
>>
>>                 --
>>                 Regards,
>>                 Pranav Kant,
>>                 Department of Computer Science
>>                 National Institute of Technology Hamirpur
>>                 http://pricked.in/
>>
>>
>>
>>                 --
>>                 Regards,
>>                 Pranav Kant,
>>                 Department of Computer Science
>>                 National Institute of Technology Hamirpur
>>                 http://pricked.in/
>>
>>                 _______________________________________________
>>                 LLVM Developers mailing list
>>                 LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu>
>>                 http://llvm.cs.uiuc.edu
>>                 http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>>
>>
>>
>>         --
>>         Regards,
>>         Pranav Kant,
>>         Department of Computer Science
>>         National Institute of Technology Hamirpur
>>         http://pricked.in/
>>
>>
>>
>>
>>
>> --
>> Regards,
>> Pranav Kant,
>> Department of Computer Science
>> National Institute of Technology Hamirpur
>> http://pricked.in/
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>
>


-- 
Regards,
Pranav Kant,
Department of Computer Science
National Institute of Technology Hamirpur
http://pricked.in/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150210/58c71959/attachment.html>


More information about the llvm-dev mailing list