[llvm] r355773 - [RISCV][NFC] Minor refactoring of CC_RISCV

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 9 03:16:27 PST 2019


Author: asb
Date: Sat Mar  9 03:16:27 2019
New Revision: 355773

URL: http://llvm.org/viewvc/llvm-project?rev=355773&view=rev
Log:
[RISCV][NFC] Minor refactoring of CC_RISCV

Immediately check if we need to early-exit as we have a return value that
can't be returned directly. Also tweak following if/else.


Modified:
    llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp

Modified: llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp?rev=355773&r1=355772&r2=355773&view=diff
==============================================================================
--- llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp Sat Mar  9 03:16:27 2019
@@ -940,20 +940,20 @@ static bool CC_RISCV(const DataLayout &D
   unsigned XLen = DL.getLargestLegalIntTypeSizeInBits();
   assert(XLen == 32 || XLen == 64);
   MVT XLenVT = XLen == 32 ? MVT::i32 : MVT::i64;
+
+  // Any return value split in to more than two values can't be returned
+  // directly.
+  if (IsRet && ValNo > 1)
+    return true;
+
   if (ValVT == MVT::f32) {
     LocVT = XLenVT;
     LocInfo = CCValAssign::BCvt;
-  }
-  if (XLen == 64 && ValVT == MVT::f64) {
+  } else if (XLen == 64 && ValVT == MVT::f64) {
     LocVT = MVT::i64;
     LocInfo = CCValAssign::BCvt;
   }
 
-  // Any return value split in to more than two values can't be returned
-  // directly.
-  if (IsRet && ValNo > 1)
-    return true;
-
   // If this is a variadic argument, the RISC-V calling convention requires
   // that it is assigned an 'even' or 'aligned' register if it has 8-byte
   // alignment (RV32) or 16-byte alignment (RV64). An aligned register should




More information about the llvm-commits mailing list