[llvm] [CodeGen] Don't allow function alignment less than the target's minimum (PR #90415)

Doug Wyatt via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 08:00:57 PDT 2024


dougsonos wrote:

> Ideally, we should just fix clang so it doesn't make this request in the first place.

OK ... I verified that this underalignment only happens on C++ methods, where this code (right after your reference) causes Clang to emit a specific alignment on the function where otherwise it would not. Functions where Clang does not specify alignment do not end up underaligned.

```
  if (getTarget().getCXXABI().areMemberFunctionsAligned()) {
    if (isa<CXXMethodDecl>(D) && F->getPointerAlignment(getDataLayout()) < 2)
      F->setAlignment(std::max(llvm::Align(2), F->getAlign().valueOrOne()));
  }
```

So are you suggesting that the data layout's function pointer alignment should be set, and used here as another lower bound? Currently arm64 has no specified function pointer alignment.

Thanks for the reply.

https://github.com/llvm/llvm-project/pull/90415


More information about the llvm-commits mailing list