aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Target
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/lib/Target')
-rw-r--r--mlir/lib/Target/LLVM/ModuleToObject.cpp7
-rw-r--r--mlir/lib/Target/LLVM/ROCDL/Target.cpp2
-rw-r--r--mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp9
-rw-r--r--mlir/lib/Target/LLVMIR/Transforms/TargetUtils.cpp7
-rw-r--r--mlir/lib/Target/LLVMIR/TypeToLLVM.cpp4
5 files changed, 12 insertions, 17 deletions
diff --git a/mlir/lib/Target/LLVM/ModuleToObject.cpp b/mlir/lib/Target/LLVM/ModuleToObject.cpp
index 5055cd9..4098ccc 100644
--- a/mlir/lib/Target/LLVM/ModuleToObject.cpp
+++ b/mlir/lib/Target/LLVM/ModuleToObject.cpp
@@ -56,8 +56,9 @@ ModuleToObject::getOrCreateTargetMachine() {
return targetMachine.get();
// Load the target.
std::string error;
+ llvm::Triple parsedTriple(triple);
const llvm::Target *target =
- llvm::TargetRegistry::lookupTarget(triple, error);
+ llvm::TargetRegistry::lookupTarget(parsedTriple, error);
if (!target) {
getOperation().emitError()
<< "Failed to lookup target for triple '" << triple << "' " << error;
@@ -65,8 +66,8 @@ ModuleToObject::getOrCreateTargetMachine() {
}
// Create the target machine using the target.
- targetMachine.reset(target->createTargetMachine(llvm::Triple(triple), chip,
- features, {}, {}));
+ targetMachine.reset(
+ target->createTargetMachine(parsedTriple, chip, features, {}, {}));
if (!targetMachine)
return std::nullopt;
return targetMachine.get();
diff --git a/mlir/lib/Target/LLVM/ROCDL/Target.cpp b/mlir/lib/Target/LLVM/ROCDL/Target.cpp
index c9888c3..f813f8d 100644
--- a/mlir/lib/Target/LLVM/ROCDL/Target.cpp
+++ b/mlir/lib/Target/LLVM/ROCDL/Target.cpp
@@ -289,7 +289,7 @@ SerializeGPUModuleBase::assembleIsa(StringRef isa) {
llvm::Triple triple(llvm::Triple::normalize(targetTriple));
std::string error;
const llvm::Target *target =
- llvm::TargetRegistry::lookupTarget(triple.normalize(), error);
+ llvm::TargetRegistry::lookupTarget(triple, error);
if (!target) {
emitError(loc, Twine("failed to lookup target: ") + error);
return std::nullopt;
diff --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
index 9fcb02e..1e2099d 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
@@ -4716,10 +4716,7 @@ convertOmpTargetData(Operation *op, llvm::IRBuilderBase &builder,
info.HasNoWait = updateDataOp.getNowait();
return success();
})
- .Default([&](Operation *op) {
- llvm_unreachable("unexpected operation");
- return failure();
- });
+ .DefaultUnreachable("unexpected operation");
if (failed(result))
return failure();
@@ -5312,9 +5309,7 @@ extractHostEvalClauses(omp::TargetOp targetOp, Value &numThreads,
(void)found;
assert(found && "unsupported host_eval use");
})
- .Default([](Operation *) {
- llvm_unreachable("unsupported host_eval use");
- });
+ .DefaultUnreachable("unsupported host_eval use");
}
}
}
diff --git a/mlir/lib/Target/LLVMIR/Transforms/TargetUtils.cpp b/mlir/lib/Target/LLVMIR/Transforms/TargetUtils.cpp
index f1d3622..3f414b6 100644
--- a/mlir/lib/Target/LLVMIR/Transforms/TargetUtils.cpp
+++ b/mlir/lib/Target/LLVMIR/Transforms/TargetUtils.cpp
@@ -43,16 +43,17 @@ getTargetMachine(mlir::LLVM::TargetAttrInterface attr) {
llvm::cast_if_present<LLVM::TargetFeaturesAttr>(attr.getFeatures());
std::string features = featuresAttr ? featuresAttr.getFeaturesString() : "";
+ llvm::Triple parsedTriple(triple);
std::string error;
const llvm::Target *target =
- llvm::TargetRegistry::lookupTarget(triple, error);
+ llvm::TargetRegistry::lookupTarget(parsedTriple, error);
if (!target || !error.empty()) {
LDBG() << "Looking up target '" << triple << "' failed: " << error << "\n";
return failure();
}
- return std::unique_ptr<llvm::TargetMachine>(target->createTargetMachine(
- llvm::Triple(triple), chipAKAcpu, features, {}, {}));
+ return std::unique_ptr<llvm::TargetMachine>(
+ target->createTargetMachine(parsedTriple, chipAKAcpu, features, {}, {}));
}
FailureOr<llvm::DataLayout>
diff --git a/mlir/lib/Target/LLVMIR/TypeToLLVM.cpp b/mlir/lib/Target/LLVMIR/TypeToLLVM.cpp
index 4d20474..807a94c 100644
--- a/mlir/lib/Target/LLVMIR/TypeToLLVM.cpp
+++ b/mlir/lib/Target/LLVMIR/TypeToLLVM.cpp
@@ -74,9 +74,7 @@ public:
LLVM::LLVMPointerType, LLVM::LLVMStructType, VectorType,
LLVM::LLVMTargetExtType, PtrLikeTypeInterface>(
[this](auto type) { return this->translate(type); })
- .Default([](Type t) -> llvm::Type * {
- llvm_unreachable("unknown LLVM dialect type");
- });
+ .DefaultUnreachable("unknown LLVM dialect type");
// Cache the result of the conversion and return.
knownTranslations.try_emplace(type, translated);