[llvm] bf41fd7 - [Hexagon] Avoid unnecessary by reference passing (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 9 07:01:41 PST 2025


Author: Nikita Popov
Date: 2025-12-09T15:55:54+01:00
New Revision: bf41fd7558403c2720866db54fe01e28f5662674

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

LOG: [Hexagon] Avoid unnecessary by reference passing (NFC)

SplatVal is not modified in these functions, so pass it by value.
This was probably a copy&paste mistake from checkConstantVector(),
which does modify SplatVal.

Added: 
    

Modified: 
    llvm/lib/Target/Hexagon/HexagonGenWideningVecInstr.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/Hexagon/HexagonGenWideningVecInstr.cpp b/llvm/lib/Target/Hexagon/HexagonGenWideningVecInstr.cpp
index 478eaf10b0710..f5dc9defe5864 100644
--- a/llvm/lib/Target/Hexagon/HexagonGenWideningVecInstr.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonGenWideningVecInstr.cpp
@@ -117,9 +117,9 @@ class HexagonGenWideningVecInstr : public FunctionPass {
                              bool IsResSigned);
   bool genVAvg(Instruction *Inst);
   bool checkConstantVector(Value *OP, int64_t &SplatVal, bool IsOPZExt);
-  void updateMPYConst(Intrinsic::ID IntId, int64_t &SplatVal, bool IsOPZExt,
+  void updateMPYConst(Intrinsic::ID IntId, int64_t SplatVal, bool IsOPZExt,
                       Value *&OP, IRBuilder<> &IRB);
-  void packConstant(Intrinsic::ID IntId, int64_t &SplatVal, Value *&OP,
+  void packConstant(Intrinsic::ID IntId, int64_t SplatVal, Value *&OP,
                     IRBuilder<> &IRB);
 };
 
@@ -484,9 +484,8 @@ bool HexagonGenWideningVecInstr::checkConstantVector(Value *OP,
 }
 
 void HexagonGenWideningVecInstr::updateMPYConst(Intrinsic::ID IntId,
-                                                int64_t &SplatVal,
-                                                bool IsOPZExt, Value *&OP,
-                                                IRBuilder<> &IRB) {
+                                                int64_t SplatVal, bool IsOPZExt,
+                                                Value *&OP, IRBuilder<> &IRB) {
   if ((IntId == Intrinsic::hexagon_vmpy_uu ||
        IntId == Intrinsic::hexagon_vmpy_us ||
        IntId == Intrinsic::hexagon_vmpy_su ||
@@ -506,7 +505,7 @@ void HexagonGenWideningVecInstr::updateMPYConst(Intrinsic::ID IntId,
 }
 
 void HexagonGenWideningVecInstr::packConstant(Intrinsic::ID IntId,
-                                              int64_t &SplatVal, Value *&OP,
+                                              int64_t SplatVal, Value *&OP,
                                               IRBuilder<> &IRB) {
   uint32_t Val32 = static_cast<uint32_t>(SplatVal);
   if (IntId == Intrinsic::hexagon_vmpy_ub_ub) {


        


More information about the llvm-commits mailing list