llvm.org GIT mirror llvm / 264d245
When extending a memset range past the front, set the alignment of the memset region to the alignment of the new start address. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81810 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 10 years ago
2 changed file(s) with 19 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
272272 if (Start < I->Start) {
273273 I->Start = Start;
274274 I->StartPtr = SI->getPointerOperand();
275 I->Alignment = SI->getAlignment();
275276 }
276277
277278 // Now we know that Start <= I->End and Start >= I->Start (so the startpoint
0 ; RUN: opt < %s -S -memcpyopt | FileCheck %s
1
2 ; The resulting memset is only 4-byte aligned, despite containing
3 ; a 16-byte alignmed store in the middle.
4
5 ; CHECK: call void @llvm.memset.i64(i8* %a01, i8 0, i64 16, i32 4)
6
7 define void @foo(i32* %p) {
8 %a0 = getelementptr i32* %p, i64 0
9 store i32 0, i32* %a0, align 4
10 %a1 = getelementptr i32* %p, i64 1
11 store i32 0, i32* %a1, align 16
12 %a2 = getelementptr i32* %p, i64 2
13 store i32 0, i32* %a2, align 4
14 %a3 = getelementptr i32* %p, i64 3
15 store i32 0, i32* %a3, align 4
16 ret void
17 }