[clang] [CodeGen] Do not emit call site attributes for LLVM intrinsics. (PR #116881)

Michele Scandale via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 19 20:55:49 PST 2024


michele-scandale wrote:

I understand this is not something recommended.

Still there is already code like the one in https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CodeGenModule.cpp#L2887-L2892

```
void CodeGenModule::SetFunctionAttributes(GlobalDecl GD, llvm::Function *F,
                                          bool IsIncompleteFunction,
                                          bool IsThunk) {

  if (llvm::Intrinsic::ID IID = F->getIntrinsicID()) {
    // If this is an intrinsic function, set the function's attributes
    // to the intrinsic's attributes.
    F->setAttributes(llvm::Intrinsic::getAttributes(getLLVMContext(), IID));
    return;
  }
```

which a small trace of intention to do something special about this case.
However this code is also quite old (2011) so it might still be from a time where there was a different idea about this.


https://github.com/llvm/llvm-project/pull/116881


More information about the cfe-commits mailing list