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

Try
$ 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. :slight_smile:

- Sanjiv

test.bc (600 Bytes)