r175918 - Make sure we apply attributes to correct places.
Bill Wendling
isanbard at gmail.com
Fri Feb 22 12:53:30 PST 2013
Author: void
Date: Fri Feb 22 14:53:29 2013
New Revision: 175918
URL: http://llvm.org/viewvc/llvm-project?rev=175918&view=rev
Log:
Make sure we apply attributes to correct places.
Some attributes make sense only on the function or on the call site, but not
both. Make this distinction here.
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=175918&r1=175917&r2=175918&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Fri Feb 22 14:53:29 2013
@@ -1021,21 +1021,25 @@ void CodeGenModule::ConstructAttributeLi
if (CodeGenOpts.NoImplicitFloat)
FuncAttrs.addAttribute(llvm::Attribute::NoImplicitFloat);
- if (!TargetOpts.CPU.empty())
- FuncAttrs.addAttribute("target-cpu", TargetOpts.CPU);
+ if (AttrOnCallSite) {
+ // Attributes that should go on the call site only.
+ if (!CodeGenOpts.SimplifyLibCalls)
+ FuncAttrs.addAttribute(llvm::Attribute::NoBuiltin);
+ } else {
+ // Attributes that should go on the function, but not the call site.
+ if (!TargetOpts.CPU.empty())
+ FuncAttrs.addAttribute("target-cpu", TargetOpts.CPU);
- if (TargetOpts.Features.size()) {
- llvm::SubtargetFeatures Features;
- for (std::vector<std::string>::const_iterator
- it = TargetOpts.Features.begin(),
- ie = TargetOpts.Features.end(); it != ie; ++it)
- Features.AddFeature(*it);
- FuncAttrs.addAttribute("target-features", Features.getString());
+ if (TargetOpts.Features.size()) {
+ llvm::SubtargetFeatures Features;
+ for (std::vector<std::string>::const_iterator
+ it = TargetOpts.Features.begin(),
+ ie = TargetOpts.Features.end(); it != ie; ++it)
+ Features.AddFeature(*it);
+ FuncAttrs.addAttribute("target-features", Features.getString());
+ }
}
- if (AttrOnCallSite && !CodeGenOpts.SimplifyLibCalls)
- FuncAttrs.addAttribute(llvm::Attribute::NoBuiltin);
-
QualType RetTy = FI.getReturnType();
unsigned Index = 1;
const ABIArgInfo &RetAI = FI.getReturnInfo();
More information about the cfe-commits
mailing list