summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2015-04-27 23:11:34 +0000
committerEric Christopher <echristo@gmail.com>2015-04-27 23:11:34 +0000
commitf37ab1ca73d1442518fc685c035833fd8f1fab34 (patch)
tree4cf0d15e1b12bce9e73138e5adf3e6ab8fbf2b80 /clang/lib/CodeGen
parent7cc3494deabb58d810cb1e56636d033572ae4ee4 (diff)
downloadbcm5719-llvm-f37ab1ca73d1442518fc685c035833fd8f1fab34.tar.gz
bcm5719-llvm-f37ab1ca73d1442518fc685c035833fd8f1fab34.zip
Always add the target-cpu and target-features sets if they're non-null.
This makes sure that the front end is specific about what they're expecting the backend to produce. Update a FIXME with the idea that the target-features could be more precise using backend knowledge. llvm-svn: 235936
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 2e180c97eee..0bdc50813f4 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -1483,15 +1483,15 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
// Add target-cpu and target-features work if they differ from the defaults.
std::string &CPU = getTarget().getTargetOpts().CPU;
- if (CPU != "" && CPU != getTarget().getTriple().getArchName())
- FuncAttrs.addAttribute("target-cpu", getTarget().getTargetOpts().CPU);
-
- // TODO: FeaturesAsWritten gets us the features on the command line,
- // for canonicalization purposes we might want to avoid putting features
- // in the target-features set if we know it'll be one of the default
- // features in the backend, e.g. corei7-avx and +avx.
- std::vector<std::string> &Features =
- getTarget().getTargetOpts().FeaturesAsWritten;
+ if (CPU != "")
+ FuncAttrs.addAttribute("target-cpu", CPU);
+
+ // TODO: Features gets us the features on the command line including
+ // feature dependencies. For canonicalization purposes we might want to
+ // avoid putting features in the target-features set if we know it'll be one
+ // of the default features in the backend, e.g. corei7-avx and +avx or figure
+ // out non-explicit dependencies.
+ std::vector<std::string> &Features = getTarget().getTargetOpts().Features;
if (!Features.empty()) {
std::stringstream S;
std::copy(Features.begin(), Features.end(),
OpenPOWER on IntegriCloud