This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Warn but don't error on conflicting uses of prototype-less functions
ClosedPublic

Authored by sbc100 on Feb 15 2019, 1:55 PM.

Details

Summary

When we can't determine with certainty the signature of a function
import we pick the fist one we find rather than error'ing out.

The resulting program might not do what is expected since we might pick
the wrong signature. However since its behaviour in C to use the same
function with different signatures this seems beter than refusing to
compile such programs.

Fixes PR40472

Event Timeline

sbc100 created this revision.Feb 15 2019, 1:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2019, 1:55 PM
sbc100 edited the summary of this revision. (Show Details)Feb 15 2019, 1:57 PM
sbc100 added reviewers: jgravelle-google, kripken.
sbc100 retitled this revision from [WebAssembly] Warn, but don't error, on confliting uses of prototypeless functions to [WebAssembly] Warn but don't error on conflicting uses of prototype-less functions.
dschuff accepted this revision.Feb 15 2019, 2:55 PM

By "pick one at random" you mean we are rewriting one of the calls to drop or add parameters, right? And the one we pick is just the first one we happen to encounter?

This revision is now accepted and ready to land.Feb 15 2019, 2:55 PM

By "pick one at random" you mean we are rewriting one of the calls to drop or add parameters, right? And the one we pick is just the first one we happen to encounter?

Basically yes. Although the rewriting is don't in FixFunctionBitcasts, this pass simply assigned a prototype where there was none.

sbc100 edited the summary of this revision. (Show Details)Feb 15 2019, 3:32 PM
sbc100 marked an inline comment as done.Feb 15 2019, 3:36 PM
sbc100 added inline comments.
llvm/lib/Target/WebAssembly/WebAssemblyAddMissingPrototypes.cpp
105

Is there some better way to generate a warning in an llvm pass?

sbc100 updated this revision to Diff 187103.Feb 15 2019, 3:41 PM
sbc100 edited the summary of this revision. (Show Details)
  • fix warning
This revision was automatically updated to reflect the committed changes.