This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Don't do SjLj transformation when there's only setjmp
ClosedPublic

Authored by aheejin on Aug 4 2021, 9:17 PM.

Details

Summary

When there is a setjmp call in a function, we transform every callsite
of setjmp to record its information by calling saveSetjmp function,
and we also transform every callsite of a function that can longjmp to
to check if a longjmp occurred and if so jump to the corresponding
post-setjmp BB. Currently we are doing this for every function that
contains a call to setjmp, but if there is no other function call
within that function that can longjmp, this transformation of setjmp
callsite and all the preparation of setjmpTable in the entry of the
function are not necessary.

This checks if a setjmp-calling function has any other calls that can
longjmp, and if not, skips the function for the SjLj transformation.

Diff Detail

Event Timeline

aheejin created this revision.Aug 4 2021, 9:17 PM
aheejin requested review of this revision.Aug 4 2021, 9:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 4 2021, 9:17 PM
aheejin added inline comments.Aug 4 2021, 9:18 PM
llvm/test/CodeGen/WebAssembly/lower-em-sjlj-alias.ll
26

This is added because without this function call this function is not going to be a target of SjLj transformation with this CL.

aheejin edited the summary of this revision. (Show Details)Aug 5 2021, 1:27 AM
aheejin updated this revision to Diff 364378.Aug 5 2021, 1:28 AM

Make a function static

dschuff accepted this revision.Aug 5 2021, 11:21 AM
dschuff added inline comments.
llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
744

can this be collapsed into if (EnableEmSjLj && SetjmpF)?

749
This revision is now accepted and ready to land.Aug 5 2021, 11:21 AM
aheejin marked 2 inline comments as done.Aug 5 2021, 3:27 PM
aheejin updated this revision to Diff 364636.Aug 5 2021, 3:27 PM

Address comments

This revision was landed with ongoing or failed builds.Aug 5 2021, 3:29 PM
This revision was automatically updated to reflect the committed changes.