[llvm] r359873 - [SelectionDAG] Use INT_MIN as (1 << 31) is UB for signed integers. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri May 3 04:32:00 PDT 2019


Author: rksimon
Date: Fri May  3 04:32:00 2019
New Revision: 359873

URL: http://llvm.org/viewvc/llvm-project?rev=359873&view=rev
Log:
[SelectionDAG] Use INT_MIN as (1 << 31) is UB for signed integers. NFCI.

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

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=359873&r1=359872&r2=359873&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri May  3 04:32:00 2019
@@ -9056,7 +9056,7 @@ unsigned SelectionDAG::InferPtrAlignment
 
   // If this is a direct reference to a stack slot, use information about the
   // stack slot's alignment.
-  int FrameIdx = 1 << 31;
+  int FrameIdx = INT_MIN;
   int64_t FrameOffset = 0;
   if (FrameIndexSDNode *FI = dyn_cast<FrameIndexSDNode>(Ptr)) {
     FrameIdx = FI->getIndex();
@@ -9067,7 +9067,7 @@ unsigned SelectionDAG::InferPtrAlignment
     FrameOffset = Ptr.getConstantOperandVal(1);
   }
 
-  if (FrameIdx != (1 << 31)) {
+  if (FrameIdx != INT_MIN) {
     const MachineFrameInfo &MFI = getMachineFunction().getFrameInfo();
     unsigned FIInfoAlign = MinAlign(MFI.getObjectAlignment(FrameIdx),
                                     FrameOffset);




More information about the llvm-commits mailing list