[PATCH] D58218: Variable auto-init of blocks capturing self after init bugfix

JF Bastien via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 13 20:53:04 PST 2019


jfb marked an inline comment as done.
jfb added inline comments.


================
Comment at: lib/CodeGen/CGDecl.cpp:1640
     // Only initialize a __block's storage: we always initialize the header.
-    if (emission.IsEscapingByRef)
+    if (emission.IsEscapingByRef && isa<llvm::AllocaInst>(Loc.getPointer()))
       Loc = emitBlockByrefAddress(Loc, &D, /*follow=*/false);
----------------
rjmccall wrote:
> This seems like something we're likely regret eventually.  If we've already drilled down to the storage, we should propagate that information into this rather than trying to detect it retroactively here.
You mean that I should check `!capturedByInit` instead? I initially did that, but I was worried about someone adding other drill-downs and then going out of sync. My rationale was: you always start with `alloca`, so anything else means a drill-down occurred.

That being said, this isn't a strongly held belief. Happy to go your way if you think it's better, you know this code more than I do :)


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58218/new/

https://reviews.llvm.org/D58218





More information about the cfe-commits mailing list