[llvm] 3d89f2a - [RISCV] Remove null terminator from CSRegs in determineCalleeSaves. NFC (#74131)

via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 1 14:06:03 PST 2023


Author: Craig Topper
Date: 2023-12-01T14:05:55-08:00
New Revision: 3d89f2ac16c2a05450693dd0ca223891f5014c1b

URL: https://github.com/llvm/llvm-project/commit/3d89f2ac16c2a05450693dd0ca223891f5014c1b
DIFF: https://github.com/llvm/llvm-project/commit/3d89f2ac16c2a05450693dd0ca223891f5014c1b.diff

LOG: [RISCV] Remove null terminator from CSRegs in determineCalleeSaves. NFC (#74131)

Presumably this was done to make it similar to the getCalleeSavedRegs
list in RegInfo, but its simpler to use a range based for loop over the
array.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVFrameLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
index 1709ac28d3c5687..8dfea6d3862057c 100644
--- a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
@@ -981,11 +981,11 @@ void RISCVFrameLowering::determineCalleeSaves(MachineFunction &MF,
       RISCV::X5, RISCV::X6, RISCV::X7,                  /* t0-t2 */
       RISCV::X10, RISCV::X11,                           /* a0-a1, a2-a7 */
       RISCV::X12, RISCV::X13, RISCV::X14, RISCV::X15, RISCV::X16, RISCV::X17,
-      RISCV::X28, RISCV::X29, RISCV::X30, RISCV::X31, 0 /* t3-t6 */
+      RISCV::X28, RISCV::X29, RISCV::X30, RISCV::X31 /* t3-t6 */
     };
 
-    for (unsigned i = 0; CSRegs[i]; ++i)
-      SavedRegs.set(CSRegs[i]);
+    for (auto Reg : CSRegs)
+      SavedRegs.set(Reg);
 
     if (MF.getSubtarget<RISCVSubtarget>().hasStdExtF()) {
 


        


More information about the llvm-commits mailing list