This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Fix remapping branch dests in fixCatchUnwindMismatches
ClosedPublic

Authored by aheejin on Feb 26 2021, 12:05 PM.

Details

Summary

This is a case D97178 tried to solve but missed. D97178 could not handle
the case when
multiple consecutive delegates are generated:

  • Before:
block
  br (a)
  try
  catch
  end_try
end_block
          <- (a)
  • After
block
  br (a)
  try
    ...
    try
      try
      catch
      end_try
            <- (a)
    delegate
  delegate
end_block
          <- (b)

(The br should point to (b) now)

D97178 assumed end_block exists two BBs later than end_try, because
it assumed the order as end_try BB -> delegate BB -> end_block BB.
But it turned out there can be multiple delegates in between. This
patch changes the logic so we just search from end_try BB until we
find end_block.

Fixes https://github.com/emscripten-core/emscripten/issues/13515.
(More precisely, fixes
https://github.com/emscripten-core/emscripten/issues/13515#issuecomment-784711318.)

Diff Detail

Event Timeline

aheejin created this revision.Feb 26 2021, 12:05 PM
aheejin requested review of this revision.Feb 26 2021, 12:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 26 2021, 12:05 PM
aheejin updated this revision to Diff 326769.Feb 26 2021, 12:24 PM

whitespace fix

tlively accepted this revision.Feb 26 2021, 12:33 PM

Makes sense!

llvm/test/CodeGen/WebAssembly/cfg-stackify-eh.ll
1200

genearted => generated

1223

destnation => destination

This revision is now accepted and ready to land.Feb 26 2021, 12:33 PM
aheejin edited the summary of this revision. (Show Details)Feb 26 2021, 12:35 PM
aheejin marked 2 inline comments as done.

@tlively Thanks! bugpoint really helped reducing this case.

aheejin updated this revision to Diff 326772.Feb 26 2021, 12:37 PM

Address comments

aheejin edited the summary of this revision. (Show Details)Feb 26 2021, 12:38 PM
dschuff accepted this revision.Feb 26 2021, 1:19 PM
This revision was landed with ongoing or failed builds.Feb 26 2021, 1:38 PM
This revision was automatically updated to reflect the committed changes.
Harbormaster completed remote builds in B91097: Diff 326772.