[all-commits] [llvm/llvm-project] 71b170: [AIX] "aligned" attribute does not decrease alignment

Steven Wan via All-commits all-commits at lists.llvm.org
Sun Aug 29 18:33:42 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 71b170ccf36ee02e6a4c472bc1d3e89bbaf0e2b4
      https://github.com/llvm/llvm-project/commit/71b170ccf36ee02e6a4c472bc1d3e89bbaf0e2b4
  Author: Steven Wan <wanyu9511 at gmail.com>
  Date:   2021-08-29 (Sun, 29 Aug 2021)

  Changed paths:
    M clang/lib/AST/RecordLayoutBuilder.cpp
    R clang/test/Layout/aix-alignof-align-and-pack-attr.cpp
    M clang/test/Layout/aix-power-alignment-typedef.cpp
    A clang/test/Layout/aix-type-align-and-pack-attr.cpp

  Log Message:
  -----------
  [AIX] "aligned" attribute does not decrease alignment

The "aligned" attribute can only increase the alignment of a struct, or struct member, unless it's used together with the "packed" attribute, or used as a part of a typedef, in which case, the "aligned" attribute can both increase and decrease alignment.

That said, we expect:
1. "aligned" attribute alone: does not interfere with the alignment upgrade instrumented by the AIX "power" alignment rule,
2. "aligned" attribute + typedef: overrides any computed alignment,
3. "aligned" attribute + "packed" attribute: overrides any computed alignment.
The old implementation achieved 2 and 3, but didn't get 1 right, in that any field marked attribute "aligned" would not go through the alignment upgrade.

Reviewed By: rjmccall

Differential Revision: https://reviews.llvm.org/D107394




More information about the All-commits mailing list