[PATCH] D48471: [WebAssembly] Add pass to infer prototypes for prototype-less functions

Derek Schuff via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 2 14:06:52 PDT 2018


dschuff accepted this revision.
dschuff added a comment.

Otherwise LGTM



================
Comment at: lib/Target/WebAssembly/WebAssemblyAddMissingPrototypes.cpp:74
+
+    if (!F.isVarArg())
+      report_fatal_error(
----------------
This code more-or-less functions as a kind of "assert" on clang's convention of using vararg-only functions for prototypeless C functions. If that changes, or if someone accidentally creates nonconforming IR (say, with a different frontend) then they'll end up here, so it's probably worth just putting a big comment here saying that's what we're doing. Fortunately the use of the attribute minimizes risk of accidentally having this IR, so I think the actual code is fine.


================
Comment at: test/CodeGen/WebAssembly/add-prototypes.ll:11
+}
+
+declare i64 @foo(...) #1
----------------
can we add a test with a non-call use as well (e.g. storing a pointer to the function)?


Repository:
  rL LLVM

https://reviews.llvm.org/D48471





More information about the llvm-commits mailing list