[llvm] [SystemZ] Silence compiler warning (PR #113894)

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 28 03:32:00 PDT 2024


https://github.com/JonPsson1 created https://github.com/llvm/llvm-project/pull/113894

Use SystemZ::NoRegister instead of 0 in SystemZTargetLowering::getRegisterByName().


>From 12305e214df23de1b39a1280d13be795d574f4e6 Mon Sep 17 00:00:00 2001
From: Jonas Paulsson <paulson1 at linux.ibm.com>
Date: Mon, 28 Oct 2024 11:03:16 +0100
Subject: [PATCH] Silence compiler warning

---
 llvm/lib/Target/SystemZ/SystemZISelLowering.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
index 3e05f3b0180a78..1fa2dbfb26fc25 100644
--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
@@ -1400,9 +1400,11 @@ SystemZTargetLowering::getRegisterByName(const char *RegName, LLT VT,
                                          const MachineFunction &MF) const {
   Register Reg =
       StringSwitch<Register>(RegName)
-          .Case("r4", Subtarget.isTargetXPLINK64() ? SystemZ::R4D : 0)
-          .Case("r15", Subtarget.isTargetELF() ? SystemZ::R15D : 0)
-          .Default(0);
+          .Case("r4", Subtarget.isTargetXPLINK64() ? SystemZ::R4D
+                                                   : SystemZ::NoRegister)
+          .Case("r15",
+                Subtarget.isTargetELF() ? SystemZ::R15D : SystemZ::NoRegister)
+          .Default(SystemZ::NoRegister);
 
   if (Reg)
     return Reg;



More information about the llvm-commits mailing list