summaryrefslogtreecommitdiff
path: root/test/Transforms/LICM
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fim.uni-passau.de>2011-07-06 19:19:55 +0000
committerTobias Grosser <grosser@fim.uni-passau.de>2011-07-06 19:19:55 +0000
commitdf7102b7d6d472c58d5f0fcc16e0ebf07c8deb55 (patch)
treefdbb1a3e87376146da221b602aaf83d902a1fae5 /test/Transforms/LICM
parent29057766f741edc16d0faa70d4babec700b254e4 (diff)
downloadllvm-df7102b7d6d472c58d5f0fcc16e0ebf07c8deb55.tar.gz
llvm-df7102b7d6d472c58d5f0fcc16e0ebf07c8deb55.tar.bz2
llvm-df7102b7d6d472c58d5f0fcc16e0ebf07c8deb55.tar.xz
LICM: Do not loose alignment on promotion
The promotion code lost any alignment information, when hoisting loads and stores out of the loop. This lead to incorrect aligned memory accesses. We now use the largest alignment we can prove to be correct. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134520 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/LICM')
-rw-r--r--test/Transforms/LICM/2011-07-06-Alignment.ll26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/Transforms/LICM/2011-07-06-Alignment.ll b/test/Transforms/LICM/2011-07-06-Alignment.ll
new file mode 100644
index 0000000000..f97b7010bc
--- /dev/null
+++ b/test/Transforms/LICM/2011-07-06-Alignment.ll
@@ -0,0 +1,26 @@
+; RUN: opt -licm -S %s | FileCheck %s
+
+@A = common global [1024 x float] zeroinitializer, align 4
+
+define i32 @main() nounwind {
+entry:
+ br label %for.cond
+
+for.cond:
+ %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ]
+ %arrayidx = getelementptr [1024 x float]* @A, i64 0, i64 3
+ %vecidx = bitcast float* %arrayidx to <4 x float>*
+ store <4 x float> zeroinitializer, <4 x float>* %vecidx, align 4
+ %indvar.next = add i64 %indvar, 1
+ %exitcond = icmp ne i64 %indvar, 1024
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.body:
+ br label %for.cond
+
+for.end:
+ ret i32 0
+}
+
+;CHECK: store <4 x float> {{.*}} align 4
+