[llvm] 093e948 - [BitcodeReader] Change order of assignValue() arguments (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 15 01:11:09 PST 2022


Author: Nikita Popov
Date: 2022-02-15T10:11:01+01:00
New Revision: 093e9489d59eb2204bf86e4deb788abb2a27533b

URL: https://github.com/llvm/llvm-project/commit/093e9489d59eb2204bf86e4deb788abb2a27533b
DIFF: https://github.com/llvm/llvm-project/commit/093e9489d59eb2204bf86e4deb788abb2a27533b.diff

LOG: [BitcodeReader] Change order of assignValue() arguments (NFC)

Other methods in ValueList generally pass Idx first, and it is
more convention for assignment methods to have the target on the
LHS rather than RHS.

Added: 
    

Modified: 
    llvm/lib/Bitcode/Reader/BitcodeReader.cpp
    llvm/lib/Bitcode/Reader/ValueList.cpp
    llvm/lib/Bitcode/Reader/ValueList.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index f460bfe78a7e..cf8381ef1076 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -2454,7 +2454,7 @@ Error BitcodeReader::parseConstants() {
         SmallVector<int, 16> Mask;
         ShuffleVectorInst::getShuffleMask(Op2, Mask);
         Value *V = ConstantExpr::getShuffleVector(Op0, Op1, Mask);
-        ValueList.assignValue(V, CstNo);
+        ValueList.assignValue(CstNo, V);
       }
       for (auto &DelayedSelector : DelayedSelectors) {
         Type *OpTy = DelayedSelector.OpTy;
@@ -2475,7 +2475,7 @@ Error BitcodeReader::parseConstants() {
         }
         Constant *Op0 = ValueList.getConstantFwdRef(Op0Idx, SelectorTy);
         Value *V = ConstantExpr::getSelect(Op0, Op1, Op2);
-        ValueList.assignValue(V, CstNo);
+        ValueList.assignValue(CstNo, V);
       }
 
       if (NextCstNo != ValueList.size())
@@ -3062,7 +3062,7 @@ Error BitcodeReader::parseConstants() {
     }
     }
 
-    ValueList.assignValue(V, NextCstNo);
+    ValueList.assignValue(NextCstNo, V);
     ++NextCstNo;
   }
 }
@@ -5604,7 +5604,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
 
     // Non-void values get registered in the value table for future use.
     if (!I->getType()->isVoidTy())
-      ValueList.assignValue(I, NextValueNo++);
+      ValueList.assignValue(NextValueNo++, I);
   }
 
 OutOfRecordLoop:

diff  --git a/llvm/lib/Bitcode/Reader/ValueList.cpp b/llvm/lib/Bitcode/Reader/ValueList.cpp
index 2ed547efa5dd..2be1f625d053 100644
--- a/llvm/lib/Bitcode/Reader/ValueList.cpp
+++ b/llvm/lib/Bitcode/Reader/ValueList.cpp
@@ -60,7 +60,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ConstantPlaceHolder, Value)
 
 } // end namespace llvm
 
-void BitcodeReaderValueList::assignValue(Value *V, unsigned Idx) {
+void BitcodeReaderValueList::assignValue(unsigned Idx, Value *V) {
   if (Idx == size()) {
     push_back(V);
     return;

diff  --git a/llvm/lib/Bitcode/Reader/ValueList.h b/llvm/lib/Bitcode/Reader/ValueList.h
index a39617018f42..9723781ae516 100644
--- a/llvm/lib/Bitcode/Reader/ValueList.h
+++ b/llvm/lib/Bitcode/Reader/ValueList.h
@@ -84,7 +84,7 @@ class BitcodeReaderValueList {
   Constant *getConstantFwdRef(unsigned Idx, Type *Ty);
   Value *getValueFwdRef(unsigned Idx, Type *Ty);
 
-  void assignValue(Value *V, unsigned Idx);
+  void assignValue(unsigned Idx, Value *V);
 
   /// Once all constants are read, this method bulk resolves any forward
   /// references.


        


More information about the llvm-commits mailing list