[PATCH] D33663: CGCleanup: Use correct insertion point for AllocaInst

Gor Nishanov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 31 11:16:58 PDT 2017


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





More information about the cfe-commits mailing list