[PATCH] D43000: Do not move stores for coroutine allocator args
Brian Gesiak via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 6 23:37:14 PST 2018
modocache updated this revision to Diff 133157.
modocache added a comment.
Thanks, @compnerd! Updated to use your suggestion.
Repository:
rL LLVM
https://reviews.llvm.org/D43000
Files:
lib/Transforms/Coroutines/CoroSplit.cpp
Index: lib/Transforms/Coroutines/CoroSplit.cpp
===================================================================
--- lib/Transforms/Coroutines/CoroSplit.cpp
+++ lib/Transforms/Coroutines/CoroSplit.cpp
@@ -654,13 +654,25 @@
// set.
do {
Instruction *Current = Work.pop_back_val();
+ DEBUG(dbgs() << "CoroSplit: Will not relocate: " << *Current << "\n");
DoNotRelocate.insert(Current);
for (Value *U : Current->operands()) {
auto *I = dyn_cast<Instruction>(U);
if (!I)
continue;
- if (isa<AllocaInst>(U))
+
+ if (auto *A = dyn_cast<AllocaInst>(I)) {
+ // Stores to alloca instructions that occur before coroutine frame
+ // is allocated should not be moved; the stored values may be used
+ // by the coroutine frame allocator.
+ if (RelocBlocks.count(A->getParent()) != 0) {
+ for (const auto &User : A->users())
+ if (auto *SI = dyn_cast<llvm::StoreInst>(User))
+ DoNotRelocate.insert(SI);
+ }
continue;
+ }
+
if (DoNotRelocate.count(I) == 0) {
Work.push_back(I);
DoNotRelocate.insert(I);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43000.133157.patch
Type: text/x-patch
Size: 1154 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180207/0bca201b/attachment.bin>
More information about the llvm-commits
mailing list