[llvm-branch-commits] [llvm] 9d792fe - [RISCV] Remove unnecessary APInt copy. NFC

Craig Topper via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jan 20 10:39:34 PST 2021


Author: Craig Topper
Date: 2021-01-20T10:33:09-08:00
New Revision: 9d792fef577843b213aa11954820512942dc31c7

URL: https://github.com/llvm/llvm-project/commit/9d792fef577843b213aa11954820512942dc31c7
DIFF: https://github.com/llvm/llvm-project/commit/9d792fef577843b213aa11954820512942dc31c7.diff

LOG: [RISCV] Remove unnecessary APInt copy. NFC

getAPIntValue returns a const APInt& so keep it as a reference.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index a84d3a4dd006..abbdfd54e897 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -2009,7 +2009,7 @@ bool RISCVTargetLowering::isDesirableToCommuteWithShift(
     auto *C1 = dyn_cast<ConstantSDNode>(N0->getOperand(1));
     auto *C2 = dyn_cast<ConstantSDNode>(N->getOperand(1));
     if (C1 && C2) {
-      APInt C1Int = C1->getAPIntValue();
+      const APInt &C1Int = C1->getAPIntValue();
       APInt ShiftedC1Int = C1Int << C2->getAPIntValue();
 
       // We can materialise `c1 << c2` into an add immediate, so it's "free",


        


More information about the llvm-branch-commits mailing list