[llvm-dev] The value of padding when storing an aggregate into memory

Alexander Cherepanov via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 19 04:43:31 PDT 2020


On 19/08/2020 06.05, Juneyoung Lee via llvm-dev wrote:
> LangRef isn't clear about the value of padding when an aggregate value is
> stored into memory, and I'd like to suggest that storing an aggregate fills
> padding with undef.
> 
> Here are a few clues that supports this change:
> 
> - According to C17, the value of padding bytes when storing values in
> structures or unions is unspecified.
> 
> - IPSCCP ignores padding and directly stores a constant aggregate if
> possible: https://godbolt.org/z/ddWq9z
> Memcpyopt ignores padding when copying an aggregate or storing a constant:
> https://godbolt.org/z/hY6ndd / https://godbolt.org/z/3WMP5a

Interesting topic. Is any such optimization reachable from C?

-- 
Alexander Cherepanov


More information about the llvm-dev mailing list