<div dir="ltr">Hello all,<div><br></div><div>According to <b>clang/lib/CodeGen/CodeGenFunction.cpp</b>, a LLVM annotation intrinsic call has 4 arguments:</div><div><br></div><div><div>- llvm::Value *AnnotatedVal,        </div><div>- Builder.CreateBitCast(CGM.EmitAnnotationString(AnnotationStr), Int8PtrTy),</div><div>- Builder.CreateBitCast(CGM.EmitAnnotationUnit(Location), Int8PtrTy),</div><div>- CGM.EmitAnnotationLineNo(Location)</div></div><div><br></div><div>However, this is what an annotation intrinsic <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><b>char __attribute__((annotate("DIFF"))) diff</b></span> looks like in the IR:</div><div><br></div><div>@.str = private unnamed_addr constant [5 x i8] c"DIFF\00", section "llvm.metadata"<br></div><div>@.str.1 = private unnamed_addr constant [6 x i8] c"pin.c\00", section "llvm.metadata"<br></div><div><br></div><div>call void @llvm.var.annotation(i8* %diff,</div><div>                                                       i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0),</div><div>                                                       i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0),</div><div>                                                       i32 38)</div><div><br></div><div>So my question is, why don't we find any BitCast here, but a GEP?</div><div><br></div><div>Thanks for your help,</div><div><br clear="all"><div><div class="gmail_signature"><div dir="ltr">Son Tuan Vu</div></div></div>
</div></div>