[llvm] 80ff42b - [scev-aa] Make TypeSize -> uint64_t conversion explicit

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 26 01:39:11 PDT 2023


Author: Benjamin Kramer
Date: 2023-10-26T10:37:18+02:00
New Revision: 80ff42bc7bb8188fb0c239c9f2035faf1398e59a

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

LOG: [scev-aa] Make TypeSize -> uint64_t conversion explicit

Some versions of MSVC have issues with the implicit conversion, and it
also makes it clearer what's going on (the current code doesn't handle
scalable vectors)

Added: 
    

Modified: 
    llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp b/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp
index dc1af1bbb1d1613..af8232b03f1ed69 100644
--- a/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp
@@ -55,10 +55,10 @@ AliasResult SCEVAAResult::alias(const MemoryLocation &LocA,
   if (canComputePointerDiff(SE, AS, BS)) {
     unsigned BitWidth = SE.getTypeSizeInBits(AS->getType());
     APInt ASizeInt(BitWidth, LocA.Size.hasValue()
-                                 ? LocA.Size.getValue()
+                                 ? static_cast<uint64_t>(LocA.Size.getValue())
                                  : MemoryLocation::UnknownSize);
     APInt BSizeInt(BitWidth, LocB.Size.hasValue()
-                                 ? LocB.Size.getValue()
+                                 ? static_cast<uint64_t>(LocB.Size.getValue())
                                  : MemoryLocation::UnknownSize);
 
     // Compute the 
diff erence between the two pointers.


        


More information about the llvm-commits mailing list