[PATCH] D132084: [Cloning] handle blockaddress array clone in the same module

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 17 20:00:58 PDT 2022


ChuanqiXu added a comment.

For the coroutine examples, I think is not a perfect solution. Consider the case the initial_suspend is not std::suspend_always and we can edit the dispatch_table during the function: https://godbolt.org/z/rx37TaPde

In this case, it is not so right if there are multiple dispatch tables for one coroutine (The destroy functions could access the dispatch table in theory). There are consistency problems. There may be other tricky cases.

Besides the coroutine example, it will be problematic if there are multiple functions share one dispatch_table.

So at least I think it is OK to disable the use in coroutines since the address of label is not a standard feature.



================
Comment at: llvm/lib/Transforms/Utils/CloneFunction.cpp:225
+          while (isa<Constant>(U) && !isa<GlobalVariable>(U)) {
+            assert(U->getNumUses() == 1);
+            U = cast<Constant>(U)->user_back();
----------------
This assertion looks not stable. It is easy to generate code to break the assumption.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132084



More information about the llvm-commits mailing list