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

Nuno Lopes nunoplopes at sapo.pt
Thu Aug 28 14:44:52 PDT 2014


> On 27 August 2014 06:16, David Majnemer <david.majnemer at gmail.com> wrote:
>> Author: majnemer
>> Date: Wed Aug 27 00:16:04 2014
>> New Revision: 216523
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=216523&view=rev
>> Log:
>> InstCombine: Optimize GEP's involving ptrtoint better
>
>
> Hi David,
>
> I've done a bisect and this commit broke out test-suite bot:
>
> http://lab.llvm.org:8011/builders/clang-native-arm-lnt/builds/8059
>
> The big problem is that the test "result" is just an MD5. :(
>
> I'm investigating.
>
> cheers,
> --renato


I tried to specify this transformation in Alive.  The transformation 
supports more complex cases, but I get a failure even for the simplest case:

$ ./alive.py < gep.opt
Precondition: true
%0 = ptrtoint i1* %Y
%1 = sub i64 0, %0
%r = getelementptr i1* %X, %1
  =>
%0 = ptrtoint i1* %Y
%2 = ptrtoint * %X to i64
%3 = sub %2, %0
%r = inttoptr %3 to *


ERROR: Mismatch in values of i1* %r

Example:
%Y i1* = 18446744073709551615 (0xffffffffffffffffL)
%0 i64 = 18446744073709551615 (0xffffffffffffffffL)
%1 i64 = 1 (0x1)
%X i1* = 0 (0x0)
%2 i64 = 0 (0x0)
%3 i64 = 1 (0x1)
Source value: 64 (0x40)
Target value: 1 (0x1)

Note that the counterexample is assuming pointer-size=8 bits.
Let me know if I can help with debugging the transformation. (I may be 
missing some precondition; I just quickly glanced through your patch)

Nuno 




More information about the llvm-commits mailing list