[PATCH] D114419: [XCOFF] change default program code csect alignment to 32

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 16 23:15:26 PST 2021


shchenz added a comment.

In D114419#3197868 <https://reviews.llvm.org/D114419#3197868>, @jsji wrote:

> Can you try adding a testcase for Os or Oz to see what happens? I suspect that this change might override the pref alignment settings in Lowering.

There is a case `test_minsize()` in file `test/CodeGen/PowerPC/code-align.ll`, there is no change for that case, so I think there should be no change for the loop alignment after this patch?

> Also have you tried to gather the performance by changing `setPrefLoopAlignment(16)` to `setPrefLoopAlignment(32)` for AIX in PPCISelLowering.cpp?
> I suspect most of the performance improvement you get should be from chanig loop alignment for *large* loops -- we only set inner most small loops to 32 for now.

After changing `setPrefLoopAlignment(16)` to `setPrefLoopAlignment(32)` (with/without `setPrefFunctionAlignment(32)`), there is no improvements found for the benchmarks that this patch improves.

Function/Loop alignment setting in `PPCISelLowering.cpp` should be an input to the csect alignment setting in AsmPrinter. AsmPrinter must ensure the csect alignment is suitable for the Function/Loop alignments.

  AsmPrinter::emitFunctionHeader() {
    if (MAI->hasFunctionAlignment())
      emitAlignment(MF->getAlignment(), &F)
  }



  void MCObjectStreamer::emitValueToAlignment(unsigned ByteAlignment,
                                              int64_t Value,
                                              unsigned ValueSize,
                                              unsigned MaxBytesToEmit) {
    if (MaxBytesToEmit == 0)
      MaxBytesToEmit = ByteAlignment;
    insert(new MCAlignFragment(ByteAlignment, Value, ValueSize, MaxBytesToEmit));
  
    // Update the maximum alignment on the current section if necessary.
    MCSection *CurSec = getCurrentSectionOnly();
    if (ByteAlignment > CurSec->getAlignment())
      CurSec->setAlignment(Align(ByteAlignment));
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114419



More information about the llvm-commits mailing list