[llvm] 21a1bcb - [RISCV] Pass FeatureBitset by reference rather than by value. NFCI

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 4 23:12:56 PDT 2021


Author: Craig Topper
Date: 2021-07-04T23:11:40-07:00
New Revision: 21a1bcbd4df8c443ab7c0168784789b5b74a7d5c

URL: https://github.com/llvm/llvm-project/commit/21a1bcbd4df8c443ab7c0168784789b5b74a7d5c
DIFF: https://github.com/llvm/llvm-project/commit/21a1bcbd4df8c443ab7c0168784789b5b74a7d5c.diff

LOG: [RISCV] Pass FeatureBitset by reference rather than by value. NFCI

FeatureBitset is 4 64-bit values in an array. It's better passed by
reference rather than copying it.

I may be adding FeatureBitset as an argument to another function
and noticed this while working on that.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
index 16363a0ee65b6..9bdd2003cb15d 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
@@ -257,7 +257,7 @@ struct SysReg {
   FeatureBitset FeaturesRequired;
   bool isRV32Only;
 
-  bool haveRequiredFeatures(FeatureBitset ActiveFeatures) const {
+  bool haveRequiredFeatures(const FeatureBitset &ActiveFeatures) const {
     // Not in 32-bit mode.
     if (isRV32Only && ActiveFeatures[RISCV::Feature64Bit])
       return false;


        


More information about the llvm-commits mailing list