[llvm] r228819 - DataLayout: Report when the preferred alignment is less than the ABI

David Majnemer david.majnemer at gmail.com
Wed Feb 11 01:13:09 PST 2015


Author: majnemer
Date: Wed Feb 11 03:13:09 2015
New Revision: 228819

URL: http://llvm.org/viewvc/llvm-project?rev=228819&view=rev
Log:
DataLayout: Report when the preferred alignment is less than the ABI

Added:
    llvm/trunk/test/Assembler/invalid-datalayout14.ll
Modified:
    llvm/trunk/lib/IR/DataLayout.cpp

Modified: llvm/trunk/lib/IR/DataLayout.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DataLayout.cpp?rev=228819&r1=228818&r2=228819&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DataLayout.cpp (original)
+++ llvm/trunk/lib/IR/DataLayout.cpp Wed Feb 11 03:13:09 2015
@@ -312,6 +312,9 @@ void DataLayout::parseSpecifier(StringRe
         PrefAlign = inBytes(getInt(Tok));
       }
 
+      if (ABIAlign > PrefAlign)
+        report_fatal_error(
+            "Preferred alignment cannot be less than the ABI alignment");
       setAlignment(AlignType, ABIAlign, PrefAlign, Size);
 
       break;

Added: llvm/trunk/test/Assembler/invalid-datalayout14.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/invalid-datalayout14.ll?rev=228819&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/invalid-datalayout14.ll (added)
+++ llvm/trunk/test/Assembler/invalid-datalayout14.ll Wed Feb 11 03:13:09 2015
@@ -0,0 +1,3 @@
+; RUN: not llvm-as < %s 2>&1 | FileCheck %s
+target datalayout = "i64:64:16"
+; CHECK: Preferred alignment cannot be less than the ABI alignment





More information about the llvm-commits mailing list