This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Fixed AsmPrinter not emitting .functype for intrinsics
ClosedPublic

Authored by aardappel on Feb 22 2022, 3:48 PM.

Details

Summary

Intrinsics like memset were not emitted as .functype because
WebAssemblyAsmPrinter::emitExternalDecls explicitly skips symbols
that are isIntrinsic. Removing that check doesn't work, since the symbol
from the module refers to a 4-argument llvm.memset.p0i8.i32 rather
than the 3-argument memset symbol referenced in the call.
Our WebAssemblyMCLowerPrePass however does collect the
memset symbol, so the current solution is as simple as emitting
.functype for those.

Fixes: https://github.com/llvm/llvm-project/issues/53712

Diff Detail

Event Timeline

aardappel created this revision.Feb 22 2022, 3:48 PM
aardappel requested review of this revision.Feb 22 2022, 3:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 22 2022, 3:48 PM
This comment was removed by aardappel.
sbc100 accepted this revision.Feb 22 2022, 3:52 PM
sbc100 added inline comments.
llvm/test/MC/WebAssembly/extern-functype-intrinsic.ll
42

I think you can remove all the attributes here?

48

Maybe its enough to simply check for this line? Presumably a lot of the test is verified by the lack of failed verification?

This revision is now accepted and ready to land.Feb 22 2022, 3:52 PM
aardappel updated this revision to Diff 410665.Feb 22 2022, 4:04 PM
aardappel marked 2 inline comments as done.

Reduced test, and added asm roundtrip test

dschuff accepted this revision.Feb 22 2022, 4:08 PM
aardappel updated this revision to Diff 410666.Feb 22 2022, 4:12 PM

Further test reduction

This revision was landed with ongoing or failed builds.Feb 22 2022, 4:14 PM
This revision was automatically updated to reflect the committed changes.