XCore target: return error for unsupported alignment
authorRobert Lytton <robert@xmos.com>
Tue, 12 Nov 2013 10:11:05 +0000 (10:11 +0000)
committerRobert Lytton <robert@xmos.com>
Tue, 12 Nov 2013 10:11:05 +0000 (10:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194463 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/XCore/XCoreFrameLowering.cpp
test/CodeGen/XCore/alignment.ll [new file with mode: 0644]

index c60259d13f22b06e7aa1053b2d10955eaa1c2dc2..d4075e073bde343626fd41c3e9a510f9b95f5913 100644 (file)
@@ -93,6 +93,10 @@ void XCoreFrameLowering::emitPrologue(MachineFunction &MF) const {
   XCoreFunctionInfo *XFI = MF.getInfo<XCoreFunctionInfo>();
   DebugLoc dl = MBBI != MBB.end() ? MBBI->getDebugLoc() : DebugLoc();
 
+  if (MFI->getMaxAlignment() > getStackAlignment())
+    report_fatal_error("emitPrologue unsupported alignment: "
+                       + Twine(MFI->getMaxAlignment()));
+
   bool FP = hasFP(MF);
   const AttributeSet &PAL = MF.getFunction()->getAttributes();
 
diff --git a/test/CodeGen/XCore/alignment.ll b/test/CodeGen/XCore/alignment.ll
new file mode 100644 (file)
index 0000000..28bdf3b
--- /dev/null
@@ -0,0 +1,9 @@
+; RUN: not llc < %s -march=xcore 2>&1 | FileCheck %s
+
+; CHECK: emitPrologue unsupported alignment: 8
+define void @f() nounwind {
+entry:
+  %BadAlignment = alloca i64, align 8
+  ret void
+}
+