Index: lib/CodeGen/CGCall.cpp =================================================================== --- lib/CodeGen/CGCall.cpp +++ lib/CodeGen/CGCall.cpp @@ -1845,6 +1845,8 @@ FuncAttrs.addAttribute(llvm::Attribute::Convergent); if (const FunctionDecl *Fn = dyn_cast(TargetDecl)) { + if (!AttrOnCallSite && !Fn->hasPrototype()) + FuncAttrs.addAttribute("no-prototype"); AddAttributesFromFunctionProtoType( getContext(), FuncAttrs, Fn->getType()->getAs()); // Don't use [[noreturn]] or _Noreturn for a call to a virtual function. Index: test/CodeGen/no-prototype.ll =================================================================== --- /dev/null +++ test/CodeGen/no-prototype.ll @@ -0,0 +1,22 @@ +; ModuleID = '/usr/local/google/home/sbc/dev/wasm/llvm/tools/clang/test/CodeGen/prototypeless.c' +source_filename = "/usr/local/google/home/sbc/dev/wasm/llvm/tools/clang/test/CodeGen/prototypeless.c" +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-apple-darwin" + +; Function Attrs: noinline nounwind optnone +define void @bar() #0 { +entry: + call void (...) @foo() + ret void +} + +declare void @foo(...) #1 + +attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } + +!llvm.module.flags = !{!0} +!llvm.ident = !{!1} + +!0 = !{i32 1, !"wchar_size", i32 4} +!1 = !{!"clang version 7.0.0 (trunk 335193) (llvm/trunk 335137)"}