summaryrefslogtreecommitdiff
path: root/tools/lto
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2011-06-30 01:53:36 +0000
committerEvan Cheng <evan.cheng@apple.com>2011-06-30 01:53:36 +0000
commit276365dd4bc0c2160f91fd8062ae1fc90c86c324 (patch)
tree8f62085ede50575bf662a0c889caf519110c0925 /tools/lto
parentca0ede7655cbe126441dd13599eafdf442eff3a9 (diff)
downloadllvm-276365dd4bc0c2160f91fd8062ae1fc90c86c324.tar.gz
llvm-276365dd4bc0c2160f91fd8062ae1fc90c86c324.tar.bz2
llvm-276365dd4bc0c2160f91fd8062ae1fc90c86c324.tar.xz
Fix the ridiculous SubtargetFeatures API where it implicitly expects CPU name to
be the first encoded as the first feature. It then uses the CPU name to look up features / scheduling itineray even though clients know full well the CPU name being used to query these properties. The fix is to just have the clients explictly pass the CPU name! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134127 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lto')
-rw-r--r--tools/lto/LTOCodeGenerator.cpp4
-rw-r--r--tools/lto/LTOModule.cpp5
2 files changed, 5 insertions, 4 deletions
diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp
index f175255c51..630a995575 100644
--- a/tools/lto/LTOCodeGenerator.cpp
+++ b/tools/lto/LTOCodeGenerator.cpp
@@ -262,9 +262,9 @@ bool LTOCodeGenerator::determineTarget(std::string& errMsg)
// construct LTModule, hand over ownership of module and target
SubtargetFeatures Features;
- Features.getDefaultSubtargetFeatures(_mCpu, llvm::Triple(Triple));
+ Features.getDefaultSubtargetFeatures(llvm::Triple(Triple));
std::string FeatureStr = Features.getString();
- _target = march->createTargetMachine(Triple, FeatureStr);
+ _target = march->createTargetMachine(Triple, _mCpu, FeatureStr);
}
return false;
}
diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp
index 814d80bda0..f8b42f1393 100644
--- a/tools/lto/LTOModule.cpp
+++ b/tools/lto/LTOModule.cpp
@@ -157,9 +157,10 @@ LTOModule *LTOModule::makeLTOModule(MemoryBuffer *buffer,
// construct LTOModule, hand over ownership of module and target
SubtargetFeatures Features;
- Features.getDefaultSubtargetFeatures("" /* cpu */, llvm::Triple(Triple));
+ Features.getDefaultSubtargetFeatures(llvm::Triple(Triple));
std::string FeatureStr = Features.getString();
- TargetMachine *target = march->createTargetMachine(Triple, FeatureStr);
+ std::string CPU;
+ TargetMachine *target = march->createTargetMachine(Triple, CPU, FeatureStr);
LTOModule *Ret = new LTOModule(m.take(), target);
bool Err = Ret->ParseSymbols();
if (Err) {