<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Hi, Charith,</p>
<p>I don't think that we can figure this out from only what you've
presented. Could you file a bug report with the full IR for the
different cases at bugs.llvm.org? We'd need to at least see how
the %"class.internal::BlockVectorIterators::Iterator" type is
defined and how the TBAA metadata is defined in both cases, but we
might need to look at what the AA implementation is doing in more
detail.<br>
</p>
-Hal<br>
<br>
<div class="moz-cite-prefix">On 09/08/2017 12:16 PM, Charith Mendis
via llvm-dev wrote:<br>
</div>
<blockquote
cite="mid:CA+t4WYzgW909kD+Srvsb-G9LHjUraHOUVzwuCMMrRN5rzr7Veg@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div dir="ltr">
<div>Hi all,</div>
<div><br>
</div>
<div>I used LLVM's SLP vectorization pass and set the vector
register width to 64. LLVM vectorizes A,B into E. </div>
<div><br>
</div>
<div>The question is regarding aliasing, where before
vectorization LLVM returns that both A and B do not alias with
C individually. But after vectorization LLVM returns that E
which is the vectorized value of A and B does alias with D
(same as C). </div>
<div><br>
</div>
<div>Can this happen and why is LLVM's alias analysis returning
they are infact aliased?</div>
<div><br>
</div>
<div>Thank You!</div>
<div><br>
</div>
<div><b>Before vectorization</b></div>
<div><br>
</div>
<div>entry:</div>
<div> %0 = bitcast
%"class.internal::BlockVectorIterators::Iterator"* %c to i64*</div>
<div> %1 = load i64, i64* %0, align 8, !tbaa !2</div>
<div> %2 = bitcast
%"class.internal::BlockVectorIterators::Iterator"* %this to
i64*</div>
<div> store i64 %1, i64* %2, align 8, !tbaa !2</div>
<div> %global_index = getelementptr inbounds
%"class.internal::BlockVectorIterators::Iterator",
%"class.internal::BlockVectorIterators::Iterator"* %c, i64 0,
i32 1</div>
<div> A:<span style="background-color:rgb(255,255,0)"> %3 = load
i32, i32* %global_index, align 8, !tbaa !8</span></div>
<div> %global_index3 = getelementptr inbounds
%"class.internal::BlockVectorIterators::Iterator",
%"class.internal::BlockVectorIterators::Iterator"* %this, i64
0, i32 1</div>
<div> store i32 %3, i32* %global_index3, align 8, !tbaa !8</div>
<div> %index_within_block = getelementptr inbounds
%"class.internal::BlockVectorIterators::Iterator",
%"class.internal::BlockVectorIterators::Iterator"* %c, i64 0,
i32 3</div>
<div> %4 = load i32, i32* %index_within_block, align 8, !tbaa
!9</div>
<div> %index_within_block4 = getelementptr inbounds
%"class.internal::BlockVectorIterators::Iterator",
%"class.internal::BlockVectorIterators::Iterator"* %this, i64
0, i32 3</div>
<div> C: <span style="background-color:rgb(0,255,255)">store i32
%4, i32* %index_within_block4, align 8, !tbaa !9</span></div>
<div> %current_block = getelementptr inbounds
%"class.internal::BlockVectorIterators::Iterator",
%"class.internal::BlockVectorIterators::Iterator"* %c, i64 0,
i32 2</div>
<div> B: <span style="background-color:rgb(255,255,0)">%5 = load
i32, i32* %current_block, align 4, !tbaa !10</span></div>
<div> %current_block5 = getelementptr inbounds
%"class.internal::BlockVectorIterators::Iterator",
%"class.internal::BlockVectorIterators::Iterator"* %this, i64
0, i32 2</div>
<div> store i32 %5, i32* %current_block5, align 4, !tbaa !10</div>
<div> %next_break_forward = getelementptr inbounds
%"class.internal::BlockVectorIterators::Iterator",
%"class.internal::BlockVectorIterators::Iterator"* %c, i64 0,
i32 4</div>
<div> %6 = load i32, i32* %next_break_forward, align 4, !tbaa
!11</div>
<div> %next_break_forward6 = getelementptr inbounds
%"class.internal::BlockVectorIterators::Iterator",
%"class.internal::BlockVectorIterators::Iterator"* %this, i64
0, i32 4</div>
<div> store i32 %6, i32* %next_break_forward6, align 4, !tbaa
!11</div>
<div> %next_break_backward = getelementptr inbounds
%"class.internal::BlockVectorIterators::Iterator",
%"class.internal::BlockVectorIterators::Iterator"* %c, i64 0,
i32 5</div>
<div> %7 = load i32, i32* %next_break_backward, align 8, !tbaa
!12</div>
<div> %next_break_backward7 = getelementptr inbounds
%"class.internal::BlockVectorIterators::Iterator",
%"class.internal::BlockVectorIterators::Iterator"* %this, i64
0, i32 5</div>
<div> store i32 %7, i32* %next_break_backward7, align 8, !tbaa
!12</div>
<div> ret %"class.internal::BlockVectorIterators::Iterator"*
%this</div>
<div><br>
</div>
<div><br>
</div>
<div><b>After vectorization</b></div>
<div><br>
</div>
<div>
<div>entry:</div>
<div> %0 = bitcast
%"class.internal::BlockVectorIterators::Iterator"* %c to
i64*</div>
<div> %1 = load i64, i64* %0, align 8, !tbaa !2</div>
<div> %2 = bitcast
%"class.internal::BlockVectorIterators::Iterator"* %this to
i64*</div>
<div> store i64 %1, i64* %2, align 8, !tbaa !2</div>
<div> %global_index = getelementptr inbounds
%"class.internal::BlockVectorIterators::Iterator",
%"class.internal::BlockVectorIterators::Iterator"* %c, i64
0, i32 1</div>
<div> %global_index3 = getelementptr inbounds
%"class.internal::BlockVectorIterators::Iterator",
%"class.internal::BlockVectorIterators::Iterator"* %this,
i64 0, i32 1</div>
<div> %index_within_block = getelementptr inbounds
%"class.internal::BlockVectorIterators::Iterator",
%"class.internal::BlockVectorIterators::Iterator"* %c, i64
0, i32 3</div>
<div> %3 = load i32, i32* %index_within_block, align 8, !tbaa
!8</div>
<div> %index_within_block4 = getelementptr inbounds
%"class.internal::BlockVectorIterators::Iterator",
%"class.internal::BlockVectorIterators::Iterator"* %this,
i64 0, i32 3</div>
<div>D: <span style="background-color:rgb(0,255,255)"> store
i32 %3, i32* %index_within_block4, align 8, !tbaa !8</span></div>
<div> %current_block = getelementptr inbounds
%"class.internal::BlockVectorIterators::Iterator",
%"class.internal::BlockVectorIterators::Iterator"* %c, i64
0, i32 2</div>
<div> %4 = bitcast i32* %global_index to <2 x i32>*</div>
<div>E: <span style="background-color:rgb(255,255,0)"> %5 =
load <2 x i32>, <2 x i32>* %4, align 8, !tbaa
!9</span></div>
<div> %current_block5 = getelementptr inbounds
%"class.internal::BlockVectorIterators::Iterator",
%"class.internal::BlockVectorIterators::Iterator"* %this,
i64 0, i32 2</div>
<div> %6 = bitcast i32* %global_index3 to <2 x i32>*</div>
<div> store <2 x i32> %5, <2 x i32>* %6, align 8,
!tbaa !9</div>
<div> %next_break_forward = getelementptr inbounds
%"class.internal::BlockVectorIterators::Iterator",
%"class.internal::BlockVectorIterators::Iterator"* %c, i64
0, i32 4</div>
<div> %7 = load i32, i32* %next_break_forward, align 4, !tbaa
!10</div>
<div> %next_break_forward6 = getelementptr inbounds
%"class.internal::BlockVectorIterators::Iterator",
%"class.internal::BlockVectorIterators::Iterator"* %this,
i64 0, i32 4</div>
<div> store i32 %7, i32* %next_break_forward6, align 4, !tbaa
!10</div>
<div> %next_break_backward = getelementptr inbounds
%"class.internal::BlockVectorIterators::Iterator",
%"class.internal::BlockVectorIterators::Iterator"* %c, i64
0, i32 5</div>
<div> %8 = load i32, i32* %next_break_backward, align 8,
!tbaa !11</div>
<div> %next_break_backward7 = getelementptr inbounds
%"class.internal::BlockVectorIterators::Iterator",
%"class.internal::BlockVectorIterators::Iterator"* %this,
i64 0, i32 5</div>
<div> store i32 %8, i32* %next_break_backward7, align 8,
!tbaa !11</div>
<div> ret %"class.internal::BlockVectorIterators::Iterator"*
%this</div>
</div>
<div><br>
</div>
<div><br>
</div>
-- <br>
<div class="gmail_signature">
<div dir="ltr">
<div>Kind regards,<br>
Charith Mendis<br>
<br>
Graduate Student,
<div>CSAIL,<br>
<div>Massachusetts Institute of Technology</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
</body>
</html>