OSDN Git Service

[WebAssembly] Optimize the number of routing blocks in FixIrreducibleCFG
authorHeejin Ahn <aheejin@gmail.com>
Sat, 30 Mar 2019 01:31:11 +0000 (01:31 +0000)
committerHeejin Ahn <aheejin@gmail.com>
Sat, 30 Mar 2019 01:31:11 +0000 (01:31 +0000)
commit9a44b1fdb4a579e8cefbd8693b8431d2ca189d51
treea1131fd9ef5c0f2f7501f759513604ed8df828f2
parenta61db08d2e8bd0ee892cbf5009935ab87a66646a
[WebAssembly] Optimize the number of routing blocks in FixIrreducibleCFG

Summary:
Currently we create a routing block to the dispatch block for every
predecessor of every entry. So the total number of routing blocks
created will be (# of preds) * (# of entries). But we don't need to do
this: we need at most 2 routing blocks per loop entry, one for when the
predecessor is inside the loop and one for it is outside the loop. (We
can't merge these into one because this will creates another loop cycle
between blocks inside and blocks outside) This patch fixes this and
creates at most 2 routing blocks per entry.

This also renames variable `Split` to `Routing`, which I think is a bit
clearer.

Reviewers: kripken

Subscribers: sunfish, dschuff, sbc100, jgravelle-google, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357337 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp
test/CodeGen/WebAssembly/irreducible-cfg.ll
test/CodeGen/WebAssembly/irreducible-cfg.mir [new file with mode: 0644]