[llvm] 02d9a4d - [LoopPeel] Pass TripCount to computePeelCount by value instead of by reference. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 19 17:54:50 PST 2022


Author: Craig Topper
Date: 2022-01-19T17:54:45-08:00
New Revision: 02d9a4d56d7bfd353372ed8afaf2c1350d184145

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

LOG: [LoopPeel] Pass TripCount to computePeelCount by value instead of by reference. NFC

The TripCount is not modified by the function so it doesn't need
to be passed by reference. Verified by passing it as const reference
before changing to value.

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D117735

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/Utils/LoopPeel.h
    llvm/lib/Transforms/Utils/LoopPeel.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/Utils/LoopPeel.h b/llvm/include/llvm/Transforms/Utils/LoopPeel.h
index 6f1b4a8804579..7b6595c192deb 100644
--- a/llvm/include/llvm/Transforms/Utils/LoopPeel.h
+++ b/llvm/include/llvm/Transforms/Utils/LoopPeel.h
@@ -32,7 +32,7 @@ gatherPeelingPreferences(Loop *L, ScalarEvolution &SE,
 
 void computePeelCount(Loop *L, unsigned LoopSize,
                       TargetTransformInfo::PeelingPreferences &PP,
-                      unsigned &TripCount, DominatorTree &DT,
+                      unsigned TripCount, DominatorTree &DT,
                       ScalarEvolution &SE, unsigned Threshold = UINT_MAX);
 
 } // end namespace llvm

diff  --git a/llvm/lib/Transforms/Utils/LoopPeel.cpp b/llvm/lib/Transforms/Utils/LoopPeel.cpp
index e5d6728d29bff..92333408aaef9 100644
--- a/llvm/lib/Transforms/Utils/LoopPeel.cpp
+++ b/llvm/lib/Transforms/Utils/LoopPeel.cpp
@@ -359,7 +359,7 @@ static bool violatesLegacyMultiExitLoopCheck(Loop *L) {
 // Return the number of iterations we want to peel off.
 void llvm::computePeelCount(Loop *L, unsigned LoopSize,
                             TargetTransformInfo::PeelingPreferences &PP,
-                            unsigned &TripCount, DominatorTree &DT,
+                            unsigned TripCount, DominatorTree &DT,
                             ScalarEvolution &SE, unsigned Threshold) {
   assert(LoopSize > 0 && "Zero loop size is not allowed!");
   // Save the PP.PeelCount value set by the target in


        


More information about the llvm-commits mailing list