<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Arial" size="2"><span style="font-size:10pt;">
<div><font color="blue">Hello,</font></div>
<div><font color="blue"> </font></div>
<div><font color="blue">I have one question regarding the tbaa metadata !8 used for the load HdFree->name[0] in the following example.</font></div>
<div><font color="blue">Apparently the tbaa metadata !8 = !{!3, !3, i64 0} has lost the structure field information. Why not !8 = !{!6, !3, i64 16}? </font></div>
<div><font color="blue"> </font></div>
<div><font color="blue">If the structure field name is a scalar, the clang will generate accurate meta data. Why does the clang generate </font></div>
<div><font color="blue">conservative metadata for the array fields? </font></div>
<div><font color="blue"> </font></div>
<div><font color="blue">Thanks,</font></div>
<div><font color="blue"> </font></div>
<div><font color="blue">Jin</font></div>
<div> </div>
<div> </div>
<div>typedef struct TypHeader {</div>
<div> unsigned long size;</div>
<div> struct TypHeader * * ptr;</div>
<div> char name[3];</div>
<div> unsigned char type;</div>
<div>} * TypHandle;</div>
<div> </div>
<div> </div>
<div> </div>
<div>TypHandle HdFree;</div>
<div> </div>
<div>void foo(unsigned long s, unsigned char c, struct TypHeader * *p){</div>
<div> HdFree->size = s;</div>
<div> HdFree->ptr = p;</div>
<div> HdFree->name[0] = 10;</div>
<div> HdFree->type = c;</div>
<div> </div>
<div>}</div>
<div> </div>
<div>target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"</div>
<div>target triple = "x86_64-unknown-linux-gnu"</div>
<div> </div>
<div>%struct.TypHeader = type { i64, %struct.TypHeader**, [3 x i8], i8 }</div>
<div> </div>
<div>@HdFree = common global %struct.TypHeader* null, align 8</div>
<div> </div>
<div>; Function Attrs: nounwind uwtable</div>
<div>define void @foo(i64 %s, i8 zeroext %c) #0 {</div>
<div>entry:</div>
<div> %0 = load %struct.TypHeader*, %struct.TypHeader** @HdFree, align 8, !tbaa !1</div>
<div> %size = getelementptr inbounds %struct.TypHeader, %struct.TypHeader* %0, i64 0, i32 0</div>
<div> store i64 %s, i64* %size, align 8, !tbaa !5</div>
<div> %arrayidx = getelementptr inbounds %struct.TypHeader, %struct.TypHeader* %0, i64 0, i32 2, i64 0</div>
<div> store i8 102, i8* %arrayidx, align 8, !tbaa !8</div>
<div> %1 = load %struct.TypHeader*, %struct.TypHeader** @HdFree, align 8, !tbaa !1</div>
<div> %arrayidx2 = getelementptr inbounds %struct.TypHeader, %struct.TypHeader* %1, i64 0, i32 2, i64 1</div>
<div> store i8 114, i8* %arrayidx2, align 1, !tbaa !8</div>
<div> %2 = load %struct.TypHeader*, %struct.TypHeader** @HdFree, align 8, !tbaa !1</div>
<div> %arrayidx4 = getelementptr inbounds %struct.TypHeader, %struct.TypHeader* %2, i64 0, i32 2, i64 2</div>
<div> store i8 101, i8* %arrayidx4, align 2, !tbaa !8</div>
<div> %3 = load %struct.TypHeader*, %struct.TypHeader** @HdFree, align 8, !tbaa !1</div>
<div> %type = getelementptr inbounds %struct.TypHeader, %struct.TypHeader* %3, i64 0, i32 3</div>
<div> store i8 %c, i8* %type, align 1, !tbaa !9</div>
<div> ret void</div>
<div>}</div>
<div> </div>
<div>attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+sse,+sse2"
"unsafe-fp-math"="false" "use-soft-float"="false" }</div>
<div> </div>
<div>!llvm.ident = !{!0}</div>
<div> </div>
<div>!0 = !{!"clang version 3.8.0 (trunk 1545)"}</div>
<div>!1 = !{!2, !2, i64 0}</div>
<div>!2 = !{!"any pointer", !3, i64 0}</div>
<div>!3 = !{!"omnipotent char", !4, i64 0}</div>
<div>!4 = !{!"Simple C/C++ TBAA"}</div>
<div>!5 = !{!6, !7, i64 0}</div>
<div>!6 = !{!"TypHeader", !7, i64 0, !2, i64 8, !3, i64 16, !3, i64 19}</div>
<div>!7 = !{!"long", !3, i64 0}</div>
<div><font color="red">!8 = !{!3, !3, i64 0} </font></div>
<div>!9 = !{!6, !3, i64 19}</div>
<div> </div>
<div> </div>
</span></font>
</body>
</html>