[PATCH] D129288: [IR] Don't use blockaddresses as callbr arguments
Nick Desaulniers via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 7 11:08:46 PDT 2022
nickdesaulniers added a comment.
In D129288#3636534 <https://reviews.llvm.org/D129288#3636534>, @nickdesaulniers wrote:
> In D129288#3635747 <https://reviews.llvm.org/D129288#3635747>, @nikic wrote:
>
>> In D129288#3635732 <https://reviews.llvm.org/D129288#3635732>, @jyknight wrote:
>>
>>> Can't we remove blocks from the callbr target list in some circumstances? E.g. if we merge two blocks maybe?
>>
>> I believe we currently don't allow doing that, see e.g. the check in https://github.com/llvm/llvm-project/blob/26f369393d4e60c78d872c4cafcbf3fd929b9004/llvm/lib/Transforms/Utils/Local.cpp#L1092. This is because we currently don't allow callbr to have the same successor multiple times (though I think we //should// allow that, to allow transforms like these.)
>
> The main issue is that if the same operand appears in the operand list twice, we need to be careful not to remove instances; the inline asm string still needs to correspond to the same number of operands (but this isn't being proposed; I'm attacking a strawman).
Oh, I think that _is_ what @jyknight is proposing. We'd need to rewrite the asm string in that case. For example:
callbr void asm sideeffect "${0:l} ${1:l}", "!i,!i"()
to label %1 [label %4, label %4]
would have to become:
callbr void asm sideeffect "${0:l} ${0:l}", "!i,!i"()
to label %1 [label %4]
What happens if the inline asm uses identifier names rather than numeric references? (Maybe clang boils these away when lowering; haven't checked, but that question comes immediately to mind).
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129288/new/
https://reviews.llvm.org/D129288
More information about the llvm-commits
mailing list