[llvm] r216523 - InstCombine: Optimize GEP's involving ptrtointbetter

Renato Golin renato.golin at linaro.org
Thu Aug 28 15:44:00 PDT 2014


So, the problem is indeed the transformation, as it changes:

   0x0002d6c8 <+276>: mov r4, r7
   0x0002d6cc <+280>: ldr r0, [r4, #4]
   0x0002d6d0 <+284>: ldr r1, [r8]
   0x0002d6d4 <+288>: rsb r0, r0, #0
   0x0002d6d8 <+292>: asr r0, r0, r6
   0x0002d6dc <+296>: ldr r0, [r1, r0, lsl #2]
   0x0002d6e0 <+300>: ldr r1, [r5]
   0x0002d6e4 <+304>: ldr r0, [r0]

into

   0x0002d61c <+264>: mov r4, r5
   0x0002d620 <+268>: ldr r0, [r4, #4]
   0x0002d624 <+272>: ldr r1, [r8]
   0x0002d628 <+276>: ldr r0, [r1, -r0]
   0x0002d62c <+280>: ldr r1, [r7]
   0x0002d630 <+284>: ldr r0, [r0]

Note the -r0 versus (^r0>>r6)<<2, only that r0 is already negative
when it gets to the load with offset. That's from the line:

  fputs(S->name, stdout)

with r0 as S->name, and r0 being 0x0 at the final load.

Given that this transformation has also broken MIPS bots, I think we
should revert it for now until better investigations are done.

cheers,
--renato



More information about the llvm-commits mailing list