[llvm] b02c7a8 - Fix "result of 32-bit shift implicitly converted to 64 bits" MSVC warning. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 04:02:15 PDT 2020


Author: Simon Pilgrim
Date: 2020-04-02T12:02:04+01:00
New Revision: b02c7a81523f3a9d14f418e5453bd222127e780a

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

LOG: Fix "result of 32-bit shift implicitly converted to 64 bits" MSVC warning. NFCI.

The shift of 1 by an amount that is never more than 31 means that the warning is a false positive but is safe and fixes Werror builds.

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 4c8e95e7b256..5f6d8bf95517 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -9430,7 +9430,7 @@ MaybeAlign SelectionDAG::InferPtrAlign(SDValue Ptr) const {
     llvm::computeKnownBits(GV, Known, getDataLayout());
     unsigned AlignBits = Known.countMinTrailingZeros();
     if (AlignBits)
-      return commonAlignment(Align(1 << std::min(31U, AlignBits)), GVOffset);
+      return commonAlignment(Align(1ull << std::min(31U, AlignBits)), GVOffset);
   }
 
   // If this is a direct reference to a stack slot, use information about the


        


More information about the llvm-commits mailing list