[PATCH] D89711: [Coroutine] Prevent value reusing across coroutine suspensions in EarlyCSE and GVN

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 19 11:15:27 PDT 2020


efriedma added a comment.

For the first point, if the IR definition isn't consistent, I'd prefer to actually fix that, instead of work around it. There are a lot of places that assume alias analysis is accurate.

> For example, the glibc library pthread_self is defined with attribute((const)) (which would have readnone attribute in LLVM IR) even though it in fact reads global memory.

Can we fix up the attributes on pthread_self in clang?  Or are we more generally concerned with people marking their functions const?

On a related note, we probably need to change the representation of references to thread-local variables.

-----

For the second point, it isn't obvious to me that disabling CSE is universally profitable.  We can actually end up reducing the number of values live across the suspend point in some cases.  And it seems simpler to teach coroutine lowering to rematerialize instructions when it's profitable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89711



More information about the llvm-commits mailing list