[Mlir-commits] [mlir] [MLIR][LLVM] Add `llvm.experimental.constrained.fptrunc` operation (PR #86260)

Tobias Gysi llvmlistbot at llvm.org
Mon Mar 25 10:37:13 PDT 2024


================
@@ -1290,6 +1303,25 @@ DILabelAttr ModuleImport::matchLabelAttr(llvm::Value *value) {
   return debugImporter->translate(node);
 }
 
+FPExceptionBehaviorAttr
+ModuleImport::matchFPExceptionBehaviorAttr(llvm::Value *value) {
+  auto *metadata = cast<llvm::MetadataAsValue>(value);
+  auto *mdstr = cast<llvm::MDString>(metadata->getMetadata());
+  std::optional<llvm::fp::ExceptionBehavior> optLLVM =
+      llvm::convertStrToExceptionBehavior(mdstr->getString());
+  return builder.getAttr<FPExceptionBehaviorAttr>(
+      convertFPExceptionBehaviorFromLLVM(*optLLVM));
----------------
gysit wrote:

Probably the assert would check if the optional has a value here? Or can the later call to `convertFPExceptionBehaviorFromLLVM` also go wrong?

https://github.com/llvm/llvm-project/pull/86260


More information about the Mlir-commits mailing list