[llvm] [NVPTX] Add unreachable for TMA Inst Printer (PR #117850)

Durgadoss R via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 26 22:45:57 PST 2024


https://github.com/durga4github created https://github.com/llvm/llvm-project/pull/117850

This patch adds the llvm_reachable() for TMA
reduction opcode printer method.

We had this inside the default-case leading to
warning below (and hence was removed):
error: default label in switch which covers all enumeration values
       [-Werror,-Wcovered-switch-default]

>From 36ed44a794756447f3a6c35d2534e795ecd20fed Mon Sep 17 00:00:00 2001
From: Durgadoss R <durgadossr at nvidia.com>
Date: Wed, 27 Nov 2024 12:10:45 +0530
Subject: [PATCH] [NVPTX] Add unreachable for TMA Inst Printer

This patch adds the llvm_reachable() for TMA
reduction opcode printer method.

We had this inside the default-case leading to
warning below (and hence was removed):
error: default label in switch which covers all enumeration values
       [-Werror,-Wcovered-switch-default]

Signed-off-by: Durgadoss R <durgadossr at nvidia.com>
---
 llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.cpp b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.cpp
index 0f38f644e89af5..65e1893d3f3bdf 100644
--- a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.cpp
+++ b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.cpp
@@ -450,4 +450,6 @@ void NVPTXInstPrinter::printTmaReductionMode(const MCInst *MI, int OpNum,
     O << ".xor";
     return;
   }
+  llvm_unreachable(
+      "Invalid Reduction Op in printCpAsyncBulkTensorReductionMode");
 }



More information about the llvm-commits mailing list