[llvm-dev] Offsets in TBAA Access Tags

José Wesley Magalhães via llvm-dev llvm-dev at lists.llvm.org
Mon Apr 26 06:42:57 PDT 2021


Dear LLVMers,

I'm following the TBAA section from the LLVM
Language Reference Manual, and I found a minor
detail in the offsets in the access tags.

For example:

void f(struct Outer* outer, struct Inner* inner, float* f, int* i, char* c) {
  outer->f = 0;            // tag0: (OuterStructTy, FloatScalarTy, 0)
  outer->inner_a.i = 0;    // tag1: (OuterStructTy, IntScalarTy, 12)
  outer->inner_a.f = 0.0;  // tag2: (OuterStructTy, FloatScalarTy, 16)
  *f = 0.0;                // tag3: (FloatScalarTy, FloatScalarTy, 0)}


When this program is compiled to the IR, the
offsets in tag1 and tag2 are actually 4 bytes more
than the indicated in the text. (x86_64 architecture)

store i32 0, i32* %i2, align 8, !dbg !46, !tbaa !47
!47 = !{!38, !44, i64 16} (tag1)

store float 0.000000e+00, float* %f4, align 4, !dbg !49, !tbaa !50
!50 = !{!38, !39, i64 20} (tag2)

Is this an error in the manual, or is just some padding
within structs Outer and Inner that are yielding
such a difference?

Best regards,

José Wesley de Souza Magalhães
MSc Student in Computer Science
Belo Horizonte/MG - Brazil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210426/2bcc4039/attachment.html>


More information about the llvm-dev mailing list