llvm.org GIT mirror llvm / dc10e65
Merge 81810 from mainline. 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/branches/release_26@81976 91177308-0d34-0410-b5e6-96231b3b80d8 Tanya Lattner 10 years ago
2 changed file(s) with 19 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
270270 if (Start < I->Start) {
271271 I->Start = Start;
272272 I->StartPtr = SI->getPointerOperand();
273 I->Alignment = SI->getAlignment();
273274 }
274275
275276 // 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 }