[PATCH] D144302: [PGO] Setting ValueProfNode Array's Alignment

Qiongsi Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 22 10:05:52 PST 2023


qiongsiwu1 added a comment.

In D144302#4143493 <https://reviews.llvm.org/D144302#4143493>, @MaskRay wrote:

> On ILP32 targets, `sizeof(ValueProfNode) = 20`. The forced alignment 8 is not a divisor of 20 and there may be alignment padding between two `ValueProfNode` instances.

Ah thanks so much for catching this!

I did some experiments but I was not able to reproduce `sizeof(ValueProfNode) = 20` with ILP32 or with 32 bit pointers. `ValueProfNode`'s definition (https://github.com/llvm/llvm-project/blob/9248b5d3fca19a31fde76e7df294d75f52779641/compiler-rt/include/profile/InstrProfData.inc#L95) states that it has 3 fields `{int64, int64, ptr}`. There are no fields of type `long`. When compiling with 32 bit pointers, the size of the structure is 24, instead of 20 due to padding (at least during my experiments on AIX).

An additional experiment I tried was to use `getABITypeAlign(VNodesTy)` and `getPrefTypeAlign(VNodesTy)` to compute the alignment. Both methods returned `8` when I run `opt` with command `opt -mtriple=i386-unknown-linux -target-abi ilp32 -passes=instrprof -S`. Maybe I am not doing my experiments correctly? Is there a specific target triple I should try?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144302/new/

https://reviews.llvm.org/D144302



More information about the llvm-commits mailing list