This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Fix bugs in WebAssemblyLowerEmscriptenExceptions pass
ClosedPublic

Authored by aheejin on Aug 8 2016, 3:52 AM.

Details

Summary

This patch fixes several bugs in WebAssemblyLowerEmscriptenExceptions pass. Depends on D22958.

  1. Delete '_' prefixes from JS library function names. fixImports() function in JS glue code deals with this for wasm.
  2. Change command-line option names in order to be consistent with asm.js.
  3. Add missing lowering code for llvm.eh.typeid.for intrinsics
  4. Delete commas in mangled function names
  5. Fix a function argument attributes bug. Because we add the pointer to the original callee as the first argument of invoke wrapper, all argument attribute indices have to be incremented by one.

Diff Detail

Repository
rL LLVM

Event Timeline

aheejin updated this revision to Diff 67142.Aug 8 2016, 3:52 AM
aheejin retitled this revision from to [WebAssembly] Fix bugs in WebAssemblyLowerEmscriptenExceptions pass.
aheejin updated this object.
aheejin added reviewers: dschuff, jpp.
aheejin updated this object.Aug 8 2016, 3:53 AM
aheejin updated this object.
aheejin updated this object.
aheejin updated this revision to Diff 67143.Aug 8 2016, 4:47 AM

Add a test case for -emscripten-cxx-exceptions-whitelist option & Fix a bug

dschuff edited edge metadata.Aug 8 2016, 9:10 AM

Can we split the bugfixes into a separate CL from the cxx-exceptions-whitelist option (which is new functionality)?

aheejin updated this revision to Diff 67230.Aug 8 2016, 3:07 PM
aheejin edited edge metadata.

Removed the cxx-exceptions-whitelist option from this CL

aheejin updated this revision to Diff 67232.Aug 8 2016, 3:07 PM

Remove the test case for cxx-exceptions-whitelist option

aheejin updated this object.Aug 8 2016, 3:25 PM
dschuff added inline comments.Aug 8 2016, 3:29 PM
lib/Target/WebAssembly/WebAssemblyLowerEmscriptenExceptions.cpp
329 ↗(On Diff #67232)

We could just have
LLVMContext &C = F.getContext();
Then this and all those getContext() calls below would be shorter.

416 ↗(On Diff #67232)

This seems subtle. Why does setAttributes have to go after setDebugLoc?

aheejin updated this revision to Diff 67238.Aug 8 2016, 3:54 PM
aheejin marked an inline comment as done.

Address comments

dschuff accepted this revision.Aug 8 2016, 5:33 PM
dschuff edited edge metadata.

LGTM

This revision is now accepted and ready to land.Aug 8 2016, 5:33 PM
This revision was automatically updated to reflect the committed changes.
aheejin added inline comments.Aug 8 2016, 5:41 PM
lib/Target/WebAssembly/WebAssemblyLowerEmscriptenExceptions.cpp
416 ↗(On Diff #67232)

In the 'invoke' case above, I changed the order of setAttributes and setDebugLoc because setAttribute part got longer so I thought it would look tidier. The reason I changed the order in this 'call' part is just to be consistent with the 'invoke' part. Does the order matter?

dschuff added inline comments.Aug 9 2016, 9:41 AM
lib/Target/WebAssembly/WebAssemblyLowerEmscriptenExceptions.cpp
416 ↗(On Diff #67232)

No, it actually doesn't; doing it just for consistency is fine, I just wanted to make sure there wasn't some subtle issue I was missing.