TargetData doesn't know the alignment of vectors :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26884 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
index b7d70e4..b6e6497 100644
--- a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
@@ -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 @@
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);