[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:50:41 PST 2021
ychen updated this revision to Diff 316274.
ychen added a comment.
rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94137/new/
https://reviews.llvm.org/D94137
Files:
llvm/lib/Transforms/Coroutines/CoroFrame.cpp
Index: llvm/lib/Transforms/Coroutines/CoroFrame.cpp
===================================================================
--- llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -758,6 +758,15 @@
// Because multiple allocas may own the same field slot,
// we add allocas to field here.
B.addFieldForAllocas(F, FrameData, Shape);
+ // Add PromiseAlloca to Allocas list so that
+ // 1. updateLayoutIndex could update its index after
+ // `performOptimizedStructLayout`
+ // 2. it is processed in insertSpills.
+ if (Shape.ABI == coro::ABI::Switch && 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(
+ PromiseAlloca, DenseMap<Instruction *, llvm::Optional<APInt>>{}, false);
// Create an entry for every spilled value.
for (auto &S : FrameData.Spills) {
FieldIDType Id = B.addField(S.first->getType(), None);
@@ -2271,13 +2280,6 @@
Shape.ABI == coro::ABI::Async)
sinkSpillUsesAfterCoroBegin(F, FrameData, Shape.CoroBegin);
Shape.FrameTy = buildFrameType(F, Shape, FrameData);
- // 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);
Shape.FramePtr = insertSpills(FrameData, Shape);
lowerLocalAllocas(LocalAllocas, DeadInstructions);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94137.316274.patch
Type: text/x-patch
Size: 1743 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210113/4fb824c5/attachment.bin>
More information about the llvm-commits
mailing list