diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2012-10-01 12:16:54 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2012-10-01 12:16:54 +0000 |
commit | 176ca71a82ca5208147fa2ff0c6f7407e77508ec (patch) | |
tree | 3b7a94db7f432a6dc7f57cf7b7b5210f78c32f4d /llvm/test | |
parent | 8f97281b9940729eabe6b155dbbfaf7a88bc4427 (diff) | |
download | bcm5719-llvm-176ca71a82ca5208147fa2ff0c6f7407e77508ec.tar.gz bcm5719-llvm-176ca71a82ca5208147fa2ff0c6f7407e77508ec.zip |
Fix several issues with alignment. We weren't always accounting for type
alignment requirements of the new alloca. As one consequence which was
reported as a bug by Duncan, we overaligned memcpy calls to ranges of
allocas after they were rewritten to types with lower alignment
requirements. Other consquences are possible, but I don't have any test
cases for them.
llvm-svn: 164937
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/Transforms/SROA/alignment.ll | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SROA/alignment.ll b/llvm/test/Transforms/SROA/alignment.ll index 02a67551a36..192b77e5ce4 100644 --- a/llvm/test/Transforms/SROA/alignment.ll +++ b/llvm/test/Transforms/SROA/alignment.ll @@ -83,3 +83,34 @@ entry: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %b_gep, i8* %x, i32 18, i32 2, i1 false) ret void } + +%struct.S = type { i8, { i64 } } + +define void @test4() { +; This test case triggered very strange alginment behavior with memcpy due to +; strang splitting. Reported by Duncan. +; CHECK: @test4 + +entry: + %D.2113 = alloca %struct.S + %Op = alloca %struct.S + %D.2114 = alloca %struct.S + %gep1 = getelementptr inbounds %struct.S* %Op, i32 0, i32 0 + store i8 0, i8* %gep1, align 8 + %gep2 = getelementptr inbounds %struct.S* %Op, i32 0, i32 1, i32 0 + %cast = bitcast i64* %gep2 to double* + store double 0.000000e+00, double* %cast, align 8 + store i64 0, i64* %gep2, align 8 + %dst1 = bitcast %struct.S* %D.2114 to i8* + %src1 = bitcast %struct.S* %Op to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst1, i8* %src1, i32 16, i32 8, i1 false) + %dst2 = bitcast %struct.S* %D.2113 to i8* + %src2 = bitcast %struct.S* %D.2114 to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst2, i8* %src2, i32 16, i32 8, i1 false) +; We get 3 memcpy calls with various reasons to shrink their alignment to 1. +; CHECK: @llvm.memcpy.p0i8.p0i8.i32(i8* %{{.*}}, i8* %{{.*}}, i32 3, i32 1, i1 false) +; CHECK: @llvm.memcpy.p0i8.p0i8.i32(i8* %{{.*}}, i8* %{{.*}}, i32 8, i32 1, i1 false) +; CHECK: @llvm.memcpy.p0i8.p0i8.i32(i8* %{{.*}}, i8* %{{.*}}, i32 11, i32 1, i1 false) + + ret void +} |