[llvm] r368055 - Re-land D65760/r367944
Diego Caballero via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 6 09:24:17 PDT 2019
Author: dcaballe
Date: Tue Aug 6 09:24:17 2019
New Revision: 368055
URL: http://llvm.org/viewvc/llvm-project?rev=368055&view=rev
Log:
Re-land D65760/r367944
Fixed most vexing parse ambiguation.
Modified:
llvm/trunk/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp
Modified: llvm/trunk/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp?rev=368055&r1=368054&r2=368055&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp Tue Aug 6 09:24:17 2019
@@ -22,7 +22,21 @@ JITTargetMachineBuilder::JITTargetMachin
Expected<JITTargetMachineBuilder> JITTargetMachineBuilder::detectHost() {
// FIXME: getProcessTriple is bogus. It returns the host LLVM was compiled on,
// rather than a valid triple for the current process.
- return JITTargetMachineBuilder(Triple(sys::getProcessTriple()));
+ JITTargetMachineBuilder TMBuilder((Triple(sys::getProcessTriple())));
+
+ // Retrieve host CPU name and sub-target features and add them to builder.
+ // Relocation model, code model and codegen opt level are kept to default
+ // values.
+ llvm::SubtargetFeatures SubtargetFeatures;
+ llvm::StringMap<bool> FeatureMap;
+ llvm::sys::getHostCPUFeatures(FeatureMap);
+ for (auto &Feature : FeatureMap)
+ SubtargetFeatures.AddFeature(Feature.first(), Feature.second);
+
+ TMBuilder.setCPU(llvm::sys::getHostCPUName());
+ TMBuilder.addFeatures(SubtargetFeatures.getFeatures());
+
+ return TMBuilder;
}
Expected<std::unique_ptr<TargetMachine>>
More information about the llvm-commits
mailing list