<div dir="ltr">On Wed, Jun 1, 2016 at 7:03 PM, Daniel Berlin via llvm-commits<br><<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>> and the obvious modification still gives right answers (ie using x->a):<br>><br>>   %5 = getelementptr inbounds %struct.A, %struct.A* %x, i32 0, i32 0<br>>   %6 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i32 0, i32 0<br>>   %7 = getelementptr inbounds i8, i8* %6, i64 %4<br>>   %8 = load i8, i8* %7, align 1<br>>   %9 = zext i8 %8 to i32<br>>   %10 = getelementptr inbounds %struct.A, %struct.A* %x, i32 0, i32 1<br>><br>><br>> %5 and %10 do *not* alias.<br>> The code says nothing about %10 and %6 or %7<br><br>What about something like:<br>  %a = getelementptr inbounds {[2 x i8], [2 x i8]}, {[2 x i8], [2 x i8]}* %p, i32 0, i32 0, i32 1<br>  %b = getelementptr inbounds {[2 x i8], [2 x i8]}, {[2 x i8], [2 x i8]}* %p, i32 0, i32 1, i32 -1<br>?<br><br>I think that's legal?  There was a similar discussion around r228498.<br><br>-Ahmed<br><br>> On Wed, Jun 1, 2016 at 7:01 PM, Daniel Berlin <<a href="mailto:dberlin@dberlin.org">dberlin@dberlin.org</a>> wrote:<br>>><br>>> Errr, this is not two GEPS of a struct type base pointer with the same<br>>> type, with a minimum of two operands, etc.<br>>><br>>> It's<br>>>   %6 = getelementptr inbounds i8, i8* %5, i64 %4<br>>>    %9 = getelementptr inbounds %struct.A, %struct.A* %x, i32 0, i32 1<br>>><br>>> This code will do nothing with this.<br>>><br>>> Want to try again?<br>>> :)<br>>><br>>><br>>> On Wed, Jun 1, 2016 at 5:49 PM, Eli Friedman <<a href="mailto:eli.friedman@gmail.com">eli.friedman@gmail.com</a>><br>>> wrote:<br>>>><br>>>> eli.friedman added a comment.<br>>>><br>>>> Example:<br>>>><br>>>>   struct A {<br>>>>     unsigned char a[10];<br>>>>     unsigned char b;<br>>>>   };<br>>>>   void f(A* x) {<br>>>>     for (unsigned i = 0; i < 11; ++i)<br>>>>       x->b += ((unsigned char*)x)[i];<br>>>>   }<br>>>><br>>>><br>>>> Repository:<br>>>>   rL LLVM<br>>>><br>>>> <a href="http://reviews.llvm.org/D20665">http://reviews.llvm.org/D20665</a><br>>>><br>>>><br>>>><br>>><br>><br>><br>> _______________________________________________<br>> llvm-commits mailing list<br>> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>><br></div>