[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:03:07 PDT 2022
nickdesaulniers added a comment.
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.)
I agree that we should allow duplicate BBs in the IR operand list for callbr. While the higher level language prevents such cases (`asm goto` will error if the same label appears more than once), it leads to dumb compilation failures when optimizing, such as: https://github.com/llvm/llvm-project/issues/45248.
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).
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129288/new/
https://reviews.llvm.org/D129288
More information about the llvm-commits
mailing list