OSDN Git Service

TargetData doesn't know the alignment of vectors :(
authorChris Lattner <sabre@nondot.org>
Mon, 20 Mar 2006 01:51:46 +0000 (01:51 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 20 Mar 2006 01:51:46 +0000 (01:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26884 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/ScheduleDAG.cpp

index b7d70e4..b6e6497 100644 (file)
@@ -20,6 +20,7 @@
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetInstrInfo.h"
 #include "llvm/Target/TargetLowering.h"
+#include "llvm/Support/MathExtras.h"
 using namespace llvm;
 
 
@@ -124,9 +125,15 @@ void ScheduleDAG::AddOperand(MachineInstr *MI, SDOperand Op,
     if (Align == 0) {
       if (CP->get()->getType() == Type::DoubleTy)
         Align = 3;  // always 8-byte align doubles.
-      else
+      else {
         Align = TM.getTargetData()
           .getTypeAlignmentShift(CP->get()->getType());
+        if (Align == 0) {
+          // Alignment of packed types.  FIXME!
+          Align = TM.getTargetData().getTypeSize(CP->get()->getType());
+          Align = Log2_64(Align);
+        }
+      }
     }
     
     unsigned Idx = ConstPool->getConstantPoolIndex(CP->get(), Align);