[LLVMdev] llvm-ld (instruction combine) breaking for this test.

Sanjiv Gupta sanjiv.gupta at microchip.com
Fri Apr 17 09:43:05 PDT 2009

$ llvm-ld test.bc

I don't know exactly how instrcombine works, but looks like it is trying 
to combine two GEPs into one, and while creating the new one it is 
passing i16 as type of index args. (as PointerWidth on pic16 is i16).     

  // Find out whether the last index in the source GEP is a sequential idx.
    bool EndsWithSequential = false;
    for (gep_type_iterator I = gep_type_begin(*cast<User>(PtrOp)),
           E = gep_type_end(*cast<User>(PtrOp)); I != E; ++I)
      EndsWithSequential = ! isa<StructType>(*I);  

   // Can we combine the two pointer arithmetics offsets?
    if (EndsWithSequential) {
      // Replace: gep (gep %P, long B), long A, ...
      // With:    T = long A+B; gep %P, T, ...

Thought that posting the testcase would be a much faster way to find out 
what is messed up. :)

- Sanjiv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.bc
Type: application/octet-stream
Size: 600 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090417/9f44025b/attachment.obj>

More information about the llvm-dev mailing list