[PATCH] D126715: [coro async] Add code to support dynamic aligment of over-aligned types in async frames
Arnold Schwaighofer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 31 15:02:37 PDT 2022
aschwaighofer added inline comments.
================
Comment at: llvm/lib/Transforms/Coroutines/CoroFrame.cpp:1575
+ Builder.CreateSub(ConstantInt::get(IntPtrTy, AI->getAlignment()),
+ ConstantInt::get(IntPtrTy, 1));
+ PtrValue = Builder.CreateAdd(PtrValue, AlignMask);
----------------
rjmccall wrote:
> Surely just doing `AI->getAlignment() - 1` is simpler.
>
> Can we trust `AI->getAlignment()` to be the same value as the alignment we used when computing the frame layout?
> Surely just doing AI->getAlignment() - 1 is simpler.
LLVM's constant folder saved my bacon there, but yes. I will fix.
> Can we trust AI->getAlignment() to be the same value as the alignment we used when computing the frame layout?
Yes. For Allocas we pass `AI->getAlign()` to `addField` as the `FieldAlignment` which is then used to compute the layout. `FieldAlignment` is only set in the `addField` function if it has not been set (it is a MaybeAlign optional).
```
Fields.push_back({FieldSize, Offset, Ty, 0, *FieldAlignment, TyAlignment,
DynamicAlignBuffer});
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126715/new/
https://reviews.llvm.org/D126715
More information about the llvm-commits
mailing list