[flang-commits] [flang] [flang][cuda] Fix buildbot failure (PR #110540)

Valentin Clement バレンタイン クレメン via flang-commits flang-commits at lists.llvm.org
Mon Sep 30 10:41:20 PDT 2024


https://github.com/clementval created https://github.com/llvm/llvm-project/pull/110540

None

>From fc4155ea31ee946c7a4e499be28bada88854311b Mon Sep 17 00:00:00 2001
From: Valentin Clement <clementval at gmail.com>
Date: Mon, 30 Sep 2024 10:40:56 -0700
Subject: [PATCH] [flang][cuda] Fix buildbot failure

---
 flang/lib/Optimizer/Transforms/CufOpConversion.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/flang/lib/Optimizer/Transforms/CufOpConversion.cpp b/flang/lib/Optimizer/Transforms/CufOpConversion.cpp
index a1405d0e85c1de..a80ca7a125abdf 100644
--- a/flang/lib/Optimizer/Transforms/CufOpConversion.cpp
+++ b/flang/lib/Optimizer/Transforms/CufOpConversion.cpp
@@ -370,18 +370,20 @@ struct CufDataTransferOpConversion
     mlir::Type srcTy = fir::unwrapRefType(op.getSrc().getType());
     mlir::Type dstTy = fir::unwrapRefType(op.getDst().getType());
 
-    unsigned mode;
+    mlir::Location loc = op.getLoc();
+    unsigned mode = 0;
     if (op.getTransferKind() == cuf::DataTransferKind::HostDevice) {
       mode = kHostToDevice;
     } else if (op.getTransferKind() == cuf::DataTransferKind::DeviceHost) {
       mode = kDeviceToHost;
     } else if (op.getTransferKind() == cuf::DataTransferKind::DeviceDevice) {
       mode = kDeviceToDevice;
+    } else {
+      mlir::emitError(loc, "unsupported transfer kind\n");
     }
 
     auto mod = op->getParentOfType<mlir::ModuleOp>();
     fir::FirOpBuilder builder(rewriter, mod);
-    mlir::Location loc = op.getLoc();
     fir::KindMapping kindMap{fir::getKindMapping(mod)};
     mlir::Value modeValue =
         builder.createIntegerConstant(loc, builder.getI32Type(), mode);



More information about the flang-commits mailing list