[llvm] 1ea8d58 - [PowerPC][NFC] Convert an if/else to a conditional.

Sean Fertile via llvm-commits llvm-commits at lists.llvm.org
Mon May 11 10:06:46 PDT 2020


Author: Sean Fertile
Date: 2020-05-11T13:05:19-04:00
New Revision: 1ea8d58f21a3505ec0e4dd168020c3846a1dfcc4

URL: https://github.com/llvm/llvm-project/commit/1ea8d58f21a3505ec0e4dd168020c3846a1dfcc4
DIFF: https://github.com/llvm/llvm-project/commit/1ea8d58f21a3505ec0e4dd168020c3846a1dfcc4.diff

LOG: [PowerPC][NFC] Convert an if/else to a conditional.

Change an if else to use a conditional which is shorter. Also name the
conditonal value to make the code clearer.

Added: 
    

Modified: 
    llvm/lib/Target/PowerPC/PPCFrameLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
index ad1f16b4820a..7fbdf97793f7 100644
--- a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
@@ -1983,11 +1983,8 @@ void PPCFrameLowering::processFunctionBeforeFrameFinalized(MachineFunction &MF,
       std::min<unsigned>(TRI->getEncodingValue(MinGPR),
                          TRI->getEncodingValue(MinG8R));
 
-    if (Subtarget.isPPC64()) {
-      LowerBound -= (31 - MinReg + 1) * 8;
-    } else {
-      LowerBound -= (31 - MinReg + 1) * 4;
-    }
+    const unsigned GPRegSize = Subtarget.isPPC64() ? 8 : 4;
+    LowerBound -= (31 - MinReg + 1) * GPRegSize;
   }
 
   // For 32-bit only, the CR save area is below the general register


        


More information about the llvm-commits mailing list