summaryrefslogtreecommitdiff
path: root/test/Transforms/SROA
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-09-26 10:45:28 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-09-26 10:45:28 +0000
commit238fd1591ee004130ca1e857cda1d270b15efe3d (patch)
tree49a9f9787eebe4d515045d08cd9f189c624b58d4 /test/Transforms/SROA
parent81b001a2209be99e42aceed74f411c7cefc4d022 (diff)
downloadllvm-238fd1591ee004130ca1e857cda1d270b15efe3d.tar.gz
llvm-238fd1591ee004130ca1e857cda1d270b15efe3d.tar.bz2
llvm-238fd1591ee004130ca1e857cda1d270b15efe3d.tar.xz
When rewriting the pointer operand to a load or store which has
alignment guarantees attached, re-compute the alignment so that we consider offsets which impact alignment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164690 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/SROA')
-rw-r--r--test/Transforms/SROA/alignment.ll18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Transforms/SROA/alignment.ll b/test/Transforms/SROA/alignment.ll
index 1223be362b..953f5118ab 100644
--- a/test/Transforms/SROA/alignment.ll
+++ b/test/Transforms/SROA/alignment.ll
@@ -28,6 +28,24 @@ entry:
ret void
}
+define void @test2() {
+; CHECK: @test2
+; CHECK: alloca i16, align 2
+; CHECK: load i8* %{{.*}}, align 1
+; CHECK: store i8 42, i8* %{{.*}}, align 1
+; CHECK: ret void
+
+entry:
+ %a = alloca { i8, i8, i8, i8 }, align 2
+ %gep1 = getelementptr { i8, i8, i8, i8 }* %a, i32 0, i32 1
+ %cast1 = bitcast i8* %gep1 to i16*
+ store volatile i16 0, i16* %cast1
+ %gep2 = getelementptr { i8, i8, i8, i8 }* %a, i32 0, i32 2
+ %result = load i8* %gep2, align 2
+ store i8 42, i8* %gep2, align 2
+ ret void
+}
+
define void @PR13920(<2 x i64>* %a, i16* %b) {
; Test that alignments on memcpy intrinsics get propagated to loads and stores.
; CHECK: @PR13920