[llvm] 2a4cbf8 - [Loads] Const correct the Size argument to isSafeToLoadUnconditionally. NFC (#96993)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 28 12:48:40 PDT 2024


Author: Craig Topper
Date: 2024-06-28T12:48:36-07:00
New Revision: 2a4cbf8d2f49a3176800137aed7ea7f8f33a0b92

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

LOG: [Loads] Const correct the Size argument to isSafeToLoadUnconditionally. NFC (#96993)

The APInt is not modified so we should pass by const reference.

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/Loads.h
    llvm/lib/Analysis/Loads.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/Loads.h b/llvm/include/llvm/Analysis/Loads.h
index a8d954b9872d9..6da1c5596b10e 100644
--- a/llvm/include/llvm/Analysis/Loads.h
+++ b/llvm/include/llvm/Analysis/Loads.h
@@ -68,7 +68,7 @@ bool isDereferenceableAndAlignedPointer(const Value *V, Align Alignment,
 /// If it is not obviously safe to load from the specified pointer, we do a
 /// quick local scan of the basic block containing ScanFrom, to determine if
 /// the address is already accessed.
-bool isSafeToLoadUnconditionally(Value *V, Align Alignment, APInt &Size,
+bool isSafeToLoadUnconditionally(Value *V, Align Alignment, const APInt &Size,
                                  const DataLayout &DL,
                                  Instruction *ScanFrom = nullptr,
                                  AssumptionCache *AC = nullptr,

diff  --git a/llvm/lib/Analysis/Loads.cpp b/llvm/lib/Analysis/Loads.cpp
index b2eb5a96d7d93..1d54a66705a2a 100644
--- a/llvm/lib/Analysis/Loads.cpp
+++ b/llvm/lib/Analysis/Loads.cpp
@@ -349,7 +349,7 @@ bool llvm::isDereferenceableAndAlignedInLoop(LoadInst *LI, Loop *L,
 ///
 /// This uses the pointee type to determine how many bytes need to be safe to
 /// load from the pointer.
-bool llvm::isSafeToLoadUnconditionally(Value *V, Align Alignment, APInt &Size,
+bool llvm::isSafeToLoadUnconditionally(Value *V, Align Alignment, const APInt &Size,
                                        const DataLayout &DL,
                                        Instruction *ScanFrom,
                                        AssumptionCache *AC,


        


More information about the llvm-commits mailing list