Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GlobalISel] Don't add duplicate successors to MBBs when translating …
…indirectbr This fixes a verifier failure on a bot: http://green.lab.llvm.org/green/job/test-suite-verify-machineinstrs-aarch64-O0-g/ ``` *** Bad machine code: MBB has duplicate entries in its successor list. *** - function: foo - basic block: %bb.5 indirectgoto (0x7fe3d687ca08) ``` One of the GCC torture suite tests (pr70460.c) has an indirectbr instruction which has duplicate blocks in its destination list. According to the langref this is allowed: > Blocks are allowed to occur multiple times in the destination list, though > this isn’t particularly useful. (https://www.llvm.org/docs/LangRef.html#indirectbr-instruction) We don't allow this in MIR. So, when we translate such an instruction, the verifier screams. This patch makes `translateIndirectBr` check if a successor has already been added to a block. If the successor is present, it is skipped rather than added twice. Differential Revision: https://reviews.llvm.org/D79609
- Loading branch information