This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Add isEHScopeReturn instruction property
ClosedPublic

Authored by aheejin on Aug 13 2018, 11:28 AM.

Details

Summary

So far, isReturn property is used to mean both a return instruction
from a functon and the end of an EH scope, a scope that starts with a EH
scope entry BB and ends with a catchret or a cleanupret instruction.
Because WinEH uses funclets, all EH-scope-ending instructions are also
real return instruction from a function. But for wasm, they only serve
as the end marker of an EH scope but not a return instruction that
exits a function. This mismatch caused incorrect prolog and epilog
generation in wasm EH scopes. This patch fixes this.

This patch is in the same vein with rL333045, which splits
MachineBasicBlock::isEHFuncletEntry into isEHFuncletEntry and
isEHScopeEntry.

Diff Detail

Repository
rL LLVM

Event Timeline

aheejin created this revision.Aug 13 2018, 11:28 AM

Was the problem just that the PEI was inserting an epilog for every instruction that isReturn?

dschuff accepted this revision.Aug 20 2018, 4:02 PM

This looks OK to me; I can't think of any good alternative to adding a new predicate. Fixing PEI directly would require having it check for particular instructions (wasm catchret), which we can't really do.

This revision is now accepted and ready to land.Aug 20 2018, 4:02 PM
This revision was automatically updated to reflect the committed changes.