This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Nullify unnecessary setjmp calls
ClosedPublic

Authored by aheejin on Jan 4 2022, 12:42 PM.

Details

Summary

D107530 did a small optimization that, if a function contains setjmp
calls but not other calls that can longjmp, we don't do SjLj
transformation on those setjmp calls, because they don't have
possibilities of returning from longjmp.

But we should remove those setjmp calls even in that case, because
Emscripten doesn't provide that function, assuming it is lowered away by
SjLj transformation. setjmp always returns 0 when called directly, so
this CL replaces them with i32 0.

Fixes https://github.com/emscripten-core/emscripten/issues/15679.

Diff Detail

Event Timeline

aheejin created this revision.Jan 4 2022, 12:42 PM
aheejin requested review of this revision.Jan 4 2022, 12:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 4 2022, 12:42 PM
dschuff accepted this revision.Jan 4 2022, 4:59 PM
dschuff added inline comments.
llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
1011
This revision is now accepted and ready to land.Jan 4 2022, 4:59 PM
This revision was landed with ongoing or failed builds.Jan 4 2022, 5:45 PM
This revision was automatically updated to reflect the committed changes.
aheejin marked an inline comment as done.