summaryrefslogtreecommitdiff
path: root/test/Assembler
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-07-28 20:12:04 +0000
committerDan Gohman <gohman@apple.com>2010-07-28 20:12:04 +0000
commit138aa2a82bc6de611f28e51332fb0a30262a58e3 (patch)
tree9457512df2e0e69b34681b03b8baede85785395c /test/Assembler
parenta0c5bf19bff7d06faa3e039a0638806c9e5a8ff6 (diff)
downloadllvm-138aa2a82bc6de611f28e51332fb0a30262a58e3.tar.gz
llvm-138aa2a82bc6de611f28e51332fb0a30262a58e3.tar.bz2
llvm-138aa2a82bc6de611f28e51332fb0a30262a58e3.tar.xz
Define a maximum supported alignment value for load, store, and
alloca instructions (constrained by their internal encoding), and add error checking for it. Fix an instcombine bug which generated huge alignment values (null is infinitely aligned). This fixes undefined behavior noticed by John Regehr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109643 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Assembler')
-rw-r--r--test/Assembler/align-inst-alloca.ll6
-rw-r--r--test/Assembler/align-inst-load.ll6
-rw-r--r--test/Assembler/align-inst-store.ll6
-rw-r--r--test/Assembler/align-inst.ll8
4 files changed, 26 insertions, 0 deletions
diff --git a/test/Assembler/align-inst-alloca.ll b/test/Assembler/align-inst-alloca.ll
new file mode 100644
index 0000000000..0343bebf18
--- /dev/null
+++ b/test/Assembler/align-inst-alloca.ll
@@ -0,0 +1,6 @@
+; RUN: not llvm-as %s -o /dev/null 2>/dev/null
+
+define void @foo() {
+ %p = alloca i1, align 1073741824
+ ret void
+}
diff --git a/test/Assembler/align-inst-load.ll b/test/Assembler/align-inst-load.ll
new file mode 100644
index 0000000000..3586be2d6e
--- /dev/null
+++ b/test/Assembler/align-inst-load.ll
@@ -0,0 +1,6 @@
+; RUN: not llvm-as %s -o /dev/null 2>/dev/null
+
+define void @foo() {
+ load i1* %p, align 1073741824
+ ret void
+}
diff --git a/test/Assembler/align-inst-store.ll b/test/Assembler/align-inst-store.ll
new file mode 100644
index 0000000000..8c3b7124b4
--- /dev/null
+++ b/test/Assembler/align-inst-store.ll
@@ -0,0 +1,6 @@
+; RUN: not llvm-as %s -o /dev/null 2>/dev/null
+
+define void @foo() {
+ store i1 false, i1* %p, align 1073741824
+ ret void
+}
diff --git a/test/Assembler/align-inst.ll b/test/Assembler/align-inst.ll
new file mode 100644
index 0000000000..7bf0b6493b
--- /dev/null
+++ b/test/Assembler/align-inst.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as %s -o /dev/null
+
+define void @foo() {
+ %p = alloca i1, align 536870912
+ load i1* %p, align 536870912
+ store i1 false, i1* %p, align 536870912
+ ret void
+}