GorNishanov added inline comments.

================
Comment at: lib/CodeGen/CGCleanup.cpp:458
       InsertBefore = Invoke->getNormalDest()->getFirstInsertionPt();
+    else if (isa<llvm::AllocaInst>(Inst))
+      InsertBefore = std::next(AllocaInsertPt->getIterator());
----------------
rnk wrote:
> This doesn't seem right, `Inst` could be a dynamic alloca. If it's static, we 
> definitely don't need to store and reload it. All static allocas better be in 
> the entry block... You might want to use `isStaticAlloca`, but that still 
> feels like we're hacking around some deeper problem.
An extra context. Without the fix:

```
coro f(int) {
  int x = co_await A{}; // compiles fine
}
```

```
coro f(int) {
  int x = 42;
  x = co_await A{}; // does not compile due to broken IR
}
```


https://reviews.llvm.org/D33663



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to