OSDN Git Service

[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)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282471 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86InstrInfo.cpp

index 66d750f..f1ad167 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 =