reland: [Local] Allow creating callbr with duplicate successors
authorNikita Popov <npopov@redhat.com>
Wed, 31 Aug 2022 20:08:20 +0000 (13:08 -0700)
committerNick Desaulniers <ndesaulniers@google.com>
Wed, 31 Aug 2022 20:23:00 +0000 (13:23 -0700)
commitab6876a40d06e7a30a2ab7c7dcb3440672e201ea
treeef8ca9e4a78802211fd9efdd947c377211185830
parent2928b230ce0e23b07c57470af5b830019b314951
reland: [Local] Allow creating callbr with duplicate successors

Since D129288, callbr is allowed to have duplicate successors. This patch removes a limitation which prevents optimizations from actually producing such callbrs.

This is probably the riskiest of all the recent callbr changes, because code with incorrect assumptions might be lurking somewhere. I fixed the one case I encountered ahead of time in https://github.com/llvm/llvm-project/commit/8201e3ef5c84561260218bc041209611aac690e3.

Reviewed By: nickdesaulniers

Differential Revision: https://reviews.llvm.org/D129997

Originally landed as
commit 08860f525a23 ("[Local] Allow creating callbr with duplicate successors")

Reverted in
commit 1cf6b93df168 ("Revert "[Local] Allow creating callbr with duplicate successors"")
llvm/lib/Transforms/Utils/Local.cpp
llvm/test/CodeGen/AArch64/callbr-asm-obj-file.ll
llvm/test/Transforms/JumpThreading/callbr-edge-split.ll
llvm/test/Transforms/JumpThreading/pr46857-callbr.ll
llvm/test/Transforms/SimplifyCFG/callbr-destinations.ll
llvm/test/Transforms/SimplifyCFG/jump-threading.ll