[PATCH] D94137: [coroutine] update promise object's final layout index
Yuanfang Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 12 16:53:18 PST 2021
ychen added inline comments.
================
Comment at: llvm/lib/Transforms/Coroutines/CoroFrame.cpp:2278-2284
// Add PromiseAlloca to Allocas list so that it is processed in insertSpills.
if (Shape.ABI == coro::ABI::Switch && Shape.SwitchLowering.PromiseAlloca)
// We assume that the promise alloca won't be modified before
// CoroBegin and no alias will be create before CoroBegin.
FrameData.Allocas.emplace_back(
Shape.SwitchLowering.PromiseAlloca,
DenseMap<Instruction *, llvm::Optional<APInt>>{}, false);
----------------
lxfind wrote:
> ychen wrote:
> > ychen wrote:
> > > lxfind wrote:
> > > > ychen wrote:
> > > > > lxfind wrote:
> > > > > > You can move this code to right after "B.addFieldForAllocas(F, FrameData, Shape);" (comments will need to be updated)
> > > > > > Then you won't need to modify "updateLayoutIndex".
> > > > > > That way I think it's actually cleaner.
> > > > > My first attempt was here. It seems `FrameTypeBuilder` object is not available here to do the update.
> > > > Not update here. But move these code to right after "B.addFieldForAllocas(F, FrameData, Shape);"
> > > I may misunderstand this. Right after "B.addFieldForAllocas(F, FrameData, Shape);", `performOptimizedStructLayout` is not yet done, how do I update the index?
> > Or you mean after `B.finish(FrameTy);`?
> You won't need to update the index manually, if you append the promise alloca to the alloca list after addFieldForAllocas. updateLayoutIndex will take care of it naturally.
Thanks for the explanation!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94137/new/
https://reviews.llvm.org/D94137
More information about the llvm-commits
mailing list