[all-commits] [llvm/llvm-project] c87b5e: [WebAssembly] Fix subregion relationship in CFGSort

Heejin Ahn via All-commits all-commits at lists.llvm.org
Wed Apr 1 08:12:59 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c87b5e7e22b2df92021ac5fcc69160901a5841a9
      https://github.com/llvm/llvm-project/commit/c87b5e7e22b2df92021ac5fcc69160901a5841a9
  Author: Heejin Ahn <aheejin at gmail.com>
  Date:   2020-04-01 (Wed, 01 Apr 2020)

  Changed paths:
    M llvm/lib/Target/WebAssembly/WebAssemblyCFGSort.cpp
    M llvm/test/CodeGen/WebAssembly/cfg-stackify-eh.ll

  Log Message:
  -----------
  [WebAssembly] Fix subregion relationship in CFGSort

Summary:
The previous code for determining the innermost region in CFGSort was
not correct. We determine subregion relationship by domination of their
headers, i.e., if region A's header dominates region B's header, B is a
subregion of A. Previously we assumed that if a BB belongs to both a
loop and an exception, the region with fewer number of BBs is the
innermost one. This may not be true, because while WebAssemblyException
contains BBs in all its subregions (loops or exceptions), MachineLoop
may not, because MachineLoop does not contain BBs that don't have a path
to its header even if they are dominated by its header.

                Loop header  <---|
                    |            |
              Exception header   |
                    | \          |
                    A  B         |
                    |   \        |
                    |    C       |
                    |            |
                Loop latch       |
                    |            |
                    -------------|

For example, in this CFG, the loop does not contain B and C, because
they don't have a path back to the loops header. But for CFGSort we
consider the exception here belongs to the loop and the exception should
be a subregion of the loop and scheduled together.

So here we should use `WE->contains(ML->getHeader())` (but not
`ML->contains(WE->getHeader())`, for the stated region above).

This also fixes some comments and deletes `Regions` vector in
`RegionInfo` class, which was not used anywere.

Reviewers: dschuff

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

Tags: #llvm

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




More information about the All-commits mailing list