[PATCH] D96711: [WebAssemblly] Fix EHPadStack update in fixCallUnwindMismatches

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 15 07:37:45 PST 2021


aheejin created this revision.
aheejin added a reviewer: tlively.
Herald added subscribers: wingo, hiraditya, jgravelle-google, sbc100, dschuff.
aheejin requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Updating `EHPadStack` with respect to `TRY` and `CATCH` instructions
have to be done after checking all other conditions, not before. Because
we did this before checking other conditions, when we encounter `TRY`
and we want to record the current mismatching range, we already have
popped up the entry from `EHPadStack`, which we need to access to record
the range.

The `baz` call in the added test needs try-delegate because the previous
TRY marker placement for `quux` was placed before `baz`, because `baz`'s
return value was stackified in RegStackify. If this wasn't stackified
this try-delegate is not strictly necessary, but at the moment it is not
easy to identify cases like this. I plan to transfer `nounwind`
attributes from the LLVM IR to prevent cases like this. The call in the
test does not have `unwind` attribute in order to test this bug, but in
many cases of this pattern the previous call has `nounwind` attribute`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96711

Files:
  llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
  llvm/test/CodeGen/WebAssembly/cfg-stackify-eh.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96711.323749.patch
Type: text/x-patch
Size: 3825 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210215/e186d519/attachment.bin>


More information about the llvm-commits mailing list