[PATCH] D17577: rewriteBuiltinFunctionDecl incorrectly tests for address-space-qualified pointer operand.

Nick Johnson via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 25 11:53:17 PST 2016

npjdesres added a comment.

I should also mention that my target works fine in releases 3.5 and 3.6, but breaks now in 3.7.  The critical difference was the introduction rewriteBuiltinFunctionDecl.

Specfiically, although rewriteBuiltinFunctionDel creates a new function declaration with name and type //similar// to the builtin, the new declaration is **NOT** a builtin because the resulting declaration does not have a builtin ID, i.e., FDecl->getBuiltinID() now returns zero.  Subsequent hooks, in particular those in CodeGenFunction::emitTargetBuiltinExpr are no longer able to select the builtin according to the builtin ID.

Without the BuiltinID, I'm not sure how my backend should implement CodeGenFunction::emitTargetBuiltinExpr.  Should it strcmp the name of every called function against a list of target builtins?

It will not be easy to expose a testcase using only in-tree targets. NVPTX is the only in-tree target that exposes builtins with address-space-qualified pointer arguments (builtins "__nvvm_atom_*_{g,s}_i" accept first parameter pointer to address space 1 or 3, respectively), and even then the NVPTX backend does not actually implement them in CodeGenFunction::EmitNVPTXBuiltinExpr.


More information about the llvm-commits mailing list