[llvm] [TailDuplicator] Only duplicate the blocks containing computed gotos (PR #114990)

Kai Luo via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 06:44:58 PST 2024


bzEq wrote:

>  can we simplify the CFG while still keeping the benefit of taildup? Maybe introduce a fake BB into the CFG or something.

The idea sounds good. Maybe outlined as
```
bb.0:
  succ: bb.0, bb.1, bb.2
  indirectbr %0
bb.1:
  succ: bb.0, bb.1, bb.2
  indirectbr %1
bb.2:
  succ: bb.0, bb.1, bb.2
  indirectbr %2
```
=>
```
bb.0:
  succ: bb.3
  indirectbr %0
bb.1:
  succ: bb.3
  indirectbr %1
bb.2:
  succ: bb.3
  indirectbr %2
bb.3:
  %3 = phi(%0, %1, %2)
  PSEUDO_INDIRECT_BR %3
```


https://github.com/llvm/llvm-project/pull/114990


More information about the llvm-commits mailing list