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

Yuanfang Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 18 12:05:01 PDT 2022


ychen added a comment.

In D132084#3732941 <https://reviews.llvm.org/D132084#3732941>, @efriedma wrote:

> In general, you can't clone when indirectbrs are involved: since the blockaddress is a constant, it needs to be valid for all the cloned versions of the indirectbr.  And you can't make different basic blocks with the same address.

I mean, there are existing VMap for new blockaddress and old blockaddress. So each cloned indirectbr has its own set of blockaddress. For this case, the cloning logic does not apply this VMap to GlobalValue that uses blockaddress. no?

> I'm not sure why you need to clone code in this context, but it's possible to lower indirectbrs to switch instructions if necessary (at the cost of slightly slower code at runtime).  See IndirectBrExpandPass.

Oh, this is helpful. I'll take a look. Thanks.


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