[PATCH] D28538: [CodeGen] [CUDA] Add the ability set default attrs on functions in linked modules.

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 13 22:44:06 PST 2017


mehdi_amini added inline comments.


================
Comment at: clang/lib/CodeGen/CGCall.cpp:1720
+      getLLVMContext(), llvm::AttributeSet::FunctionIndex, FuncAttrs);
+  F.addAttributes(llvm::AttributeSet::FunctionIndex, AS);
+}
----------------
jlebar wrote:
> mehdi_amini wrote:
> > Are we sure it always work? What if a function is annotated with an attribute incompatible with the attributes you're gonna add?
> I have no idea -- what is going to happen?
> 
> In the CUDA use-case we make tons of assumptions about the contents of libdevice -- if we're making an additional assumption here, I'm fine with that.  Obviously we don't just want to nuke all of the attributes on the incoming function, because some of them might be derived from the IR as opposed to the codegen options.
> I have no idea -- what is going to happen?

BAD THINGS WILL HAPPEN! ;)

(The verifier will fail)


https://reviews.llvm.org/D28538





More information about the llvm-commits mailing list