[LLVMdev] unexpectedly loop hanging

Alexandru Ionut Diaconescu alexandruionutdiaconescu at gmail.com
Tue May 28 01:02:09 PDT 2013


Hello everyone,

I was able to get all the execution paths between 2 points (basic blocks)
in my program (with the condition to traverse a loop only once). I mapped
all the basic blocks to integers and created a correspondent directed graph.

I was able to get all the paths (a path is represented by an integer
identifier). For my target program I have 72 paths, but the program hangs
unexpectedly at a for loop when I am adding metadata (which is containing
the paths). This part of code was working perfectly before of changing the
algorithm to traverse the loop only once. However, the traverse algorithm
should be totally independent to the part of the code where I add metadata.
The single influence that I see is that I have to add more metadata
operands to instructions. I mention that for each metadata operand I add a
path = an integer identifier. When this was working, I used to add up to 17
metadata operands, now I have up to 72.

How do I add metadata: Inside a* *loop iterating through basic blocks, for
each basic block I take a particular instruction on which I want to attach
the metadata (a path = an integer identifier). I do like this :

if( instruc )
{
LLVMContext& C = instruc->getContext();

             Value* values[cnt];
             errs()<<"\ngy: \n";
              for(int gy=0;gy<cnt;gy++)
              {

values[gy]=ConstantInt::getSigned(Type::getInt64Ty(C),myarray[gy]);
                errs()<<" "<<gy;
               }
}

1. I checked before this part of the code the values of myarray and they
are good
2. It works well for the first 6 instructions (the maximum number of
metadata operands they need is 70), but when I get to the 7th instruction
to add metadata (with 72 operands), I hangs inside the for loop from above,
having :

gy:
 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

and it hangs. Before this part of the code I print myarray[gy] and it it
prints all the values from 0 to 71 (the basic block is contained in all
possible execution paths).

What do you think is the problem? Some memory allocation (I have sufficient
allocated), maybe I cannot add so many metadata operands?

Thank you for any suggestion !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130528/bbe4da82/attachment.html>


More information about the llvm-dev mailing list