summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2015-03-02 09:34:59 +0000
committerOwen Anderson <resistor@mac.com>2015-03-02 09:34:59 +0000
commitab1c7a77d27d5482f2159bc26297d875db13b936 (patch)
treef5e91b0f8347dee376b16aed282d3a16210ae279 /llvm
parent040f2f890e95d777e19cb11f090095c86c8d2034 (diff)
downloadbcm5719-llvm-ab1c7a77d27d5482f2159bc26297d875db13b936.tar.gz
bcm5719-llvm-ab1c7a77d27d5482f2159bc26297d875db13b936.zip
Teach DataLayout that ABI alignments for non-aggregate types must be non-zero.
This manifested as assertions and/or crashes in later phases of optimization, depending on the build configuration. llvm-svn: 230939
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/IR/DataLayout.cpp3
-rw-r--r--llvm/test/Assembler/invalid-datalayout22.ll6
2 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp
index 4eb6d78d381..b6eaf6f2d99 100644
--- a/llvm/lib/IR/DataLayout.cpp
+++ b/llvm/lib/IR/DataLayout.cpp
@@ -312,6 +312,9 @@ void DataLayout::parseSpecifier(StringRef Desc) {
"Missing alignment specification in datalayout string");
Split = split(Rest, ':');
unsigned ABIAlign = inBytes(getInt(Tok));
+ if (AlignType != AGGREGATE_ALIGN && !ABIAlign)
+ report_fatal_error(
+ "ABI alignment specification must be >0 for non-aggregate types");
// Preferred alignment.
unsigned PrefAlign = ABIAlign;
diff --git a/llvm/test/Assembler/invalid-datalayout22.ll b/llvm/test/Assembler/invalid-datalayout22.ll
new file mode 100644
index 00000000000..14e4c2822ce
--- /dev/null
+++ b/llvm/test/Assembler/invalid-datalayout22.ll
@@ -0,0 +1,6 @@
+; RUN: not llvm-as < %s 2>&1 | FileCheck %s
+
+target datalayout = "v128:0:128"
+
+; CHECK: ABI alignment specification must be >0 for non-aggregate types
+
OpenPOWER on IntegriCloud