This revision was automatically updated to reflect the committed changes.
Closed by commit rG9f2ce5b915a5: [mlir][SystemZ] Fix incompatible datalayout in
SystemZ (authored by imaihal, committed by mehdi_amini).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80130/new/
https://reviews.llvm.org/D80130
Files:
mlir/lib/ExecutionEngine/ExecutionEngine.cpp
Index: mlir/lib/ExecutionEngine/ExecutionEngine.cpp
===================================================================
--- mlir/lib/ExecutionEngine/ExecutionEngine.cpp
+++ mlir/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -27,6 +27,7 @@
#include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
#include "llvm/ExecutionEngine/SectionMemoryManager.h"
#include "llvm/IR/IRBuilder.h"
+#include "llvm/MC/SubtargetFeature.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/Host.h"
@@ -119,8 +120,17 @@
errs() << "NO target: " << errorMessage << "\n";
return true;
}
- std::unique_ptr<llvm::TargetMachine> machine(
- target->createTargetMachine(targetTriple, "generic", "", {}, {}));
+
+ std::string cpu(llvm::sys::getHostCPUName());
+ llvm::SubtargetFeatures features;
+ llvm::StringMap<bool> hostFeatures;
+
+ if (llvm::sys::getHostCPUFeatures(hostFeatures))
+ for (auto &f : hostFeatures)
+ features.AddFeature(f.first(), f.second);
+
+ std::unique_ptr<llvm::TargetMachine> machine(target->createTargetMachine(
+ targetTriple, cpu, features.getString(), {}, {}));
llvmModule->setDataLayout(machine->createDataLayout());
llvmModule->setTargetTriple(targetTriple);
return false;
Index: mlir/lib/ExecutionEngine/ExecutionEngine.cpp
===================================================================
--- mlir/lib/ExecutionEngine/ExecutionEngine.cpp
+++ mlir/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -27,6 +27,7 @@
#include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
#include "llvm/ExecutionEngine/SectionMemoryManager.h"
#include "llvm/IR/IRBuilder.h"
+#include "llvm/MC/SubtargetFeature.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/Host.h"
@@ -119,8 +120,17 @@
errs() << "NO target: " << errorMessage << "\n";
return true;
}
- std::unique_ptr<llvm::TargetMachine> machine(
- target->createTargetMachine(targetTriple, "generic", "", {}, {}));
+
+ std::string cpu(llvm::sys::getHostCPUName());
+ llvm::SubtargetFeatures features;
+ llvm::StringMap<bool> hostFeatures;
+
+ if (llvm::sys::getHostCPUFeatures(hostFeatures))
+ for (auto &f : hostFeatures)
+ features.AddFeature(f.first(), f.second);
+
+ std::unique_ptr<llvm::TargetMachine> machine(target->createTargetMachine(
+ targetTriple, cpu, features.getString(), {}, {}));
llvmModule->setDataLayout(machine->createDataLayout());
llvmModule->setTargetTriple(targetTriple);
return false;
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits