This is an archive of the discontinued LLVM Phabricator instance.

Revert "[WebAssembly] MC: Mark more function aliases as functions"
AcceptedPublic

Authored by hliao on Feb 25 2020, 12:48 PM.

Details

Summary

This reverts commit 313f9f54f5a85790ae09cc48c1df54a4c635a3e3.

Diff Detail

Event Timeline

hliao created this revision.Feb 25 2020, 12:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 25 2020, 12:48 PM

It seems incorrect for me as the input IR has an alias casting function pointer to data pointer. That symbol itself should be regarded as a function symbol any more. If that IR needs to pass compilation, it should correct its generation by replacing that casting with one casting between function pointers. The casting from a function pointer to data pointer could be done within the accessor function.

sbc100 accepted this revision.Feb 25 2020, 2:14 PM

Sounds reasonable. We can looking into other solutions.

My understand is that the IR in question is perfectly valid, and can be compiled on other targets, can't it? Its only WebAssembly that can't compile this. We can't ask the producer so not produce this valid bitcode when building for WebAssembly can we?

This revision is now accepted and ready to land.Feb 25 2020, 2:14 PM

Sounds reasonable. We can looking into other solutions.

My understand is that the IR in question is perfectly valid, and can be compiled on other targets, can't it? Its only WebAssembly that can't compile this. We can't ask the producer so not produce this valid bitcode when building for WebAssembly can we?

Yeah, that IR itself is valid, but WASM has more restrictive assertions. It assumes data symbol should be referenced to data location only. As WASM is a virtual ISA, that assumption is right as all references to code fragments would be invalid except kernel entries (used in function invocation). But that's not true for other binary formats, symbols in non-function types may be offsets in code.

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp