[X86] Use std::max to calculate alignment instead of assuming RC->getSize() will...
authorCraig Topper <craig.topper@gmail.com>
Tue, 27 Sep 2016 06:44:25 +0000 (06:44 +0000)
committerCraig Topper <craig.topper@gmail.com>
Tue, 27 Sep 2016 06:44:25 +0000 (06:44 +0000)
llvm-svn: 282471

llvm/lib/Target/X86/X86InstrInfo.cpp

index 66d750fe7c04bcd6d4ea8c57ce756c0d78acdea0..f1ad1673af83171193d0d2639005aeb80fad99b7 100644 (file)
@@ -6963,7 +6963,7 @@ X86InstrInfo::unfoldMemoryOperand(SelectionDAG &DAG, SDNode *N,
       return false;
     // FIXME: If a VR128 can have size 32, we should be checking if a 32-byte
     // memory access is slow above.
-    unsigned Alignment = RC->getSize() == 32 ? 32 : 16;
+    unsigned Alignment = std::max<uint32_t>(RC->getSize(), 16);
     bool isAligned = (*MMOs.first) &&
                      (*MMOs.first)->getAlignment() >= Alignment;
     Load = DAG.getMachineNode(getLoadRegOpcode(0, RC, isAligned, Subtarget), dl,
@@ -7008,7 +7008,7 @@ X86InstrInfo::unfoldMemoryOperand(SelectionDAG &DAG, SDNode *N,
       return false;
     // FIXME: If a VR128 can have size 32, we should be checking if a 32-byte
     // memory access is slow above.
-    unsigned Alignment = RC->getSize() == 32 ? 32 : 16;
+    unsigned Alignment = std::max<uint32_t>(RC->getSize(), 16);
     bool isAligned = (*MMOs.first) &&
                      (*MMOs.first)->getAlignment() >= Alignment;
     SDNode *Store =