1; RUN: split-file %s %t 2; RUN: cat %t/main.ll %t/align4.ll > %t/a2.ll 3; RUN: cat %t/main.ll %t/align16.ll > %t/b2.ll 4; RUN: llc -mtriple=i386-unknown-freebsd -mcpu=core2 -relocation-model=pic < %t/a2.ll | FileCheck %s -check-prefix=UNALIGNED 5; RUN: llc -mtriple=i386-unknown-freebsd -mcpu=core2 -relocation-model=pic < %t/b2.ll | FileCheck %s -check-prefix=ALIGNED 6; RUN: llc -mtriple=i386-unknown-freebsd -mcpu=core2 -stackrealign -relocation-model=pic < %t/a2.ll | FileCheck %s -check-prefix=FORCEALIGNED 7 8;--- main.ll 9@arr = internal unnamed_addr global [32 x i32] zeroinitializer, align 16 10 11; PR12250 12define i32 @test1() { 13vector.ph: 14 br label %vector.body 15 16vector.body: 17 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ] 18 %0 = getelementptr inbounds [32 x i32], ptr @arr, i32 0, i32 %index 19 %wide.load = load <4 x i32>, ptr %0, align 16 20 %1 = add nsw <4 x i32> %wide.load, <i32 10, i32 10, i32 10, i32 10> 21 %2 = xor <4 x i32> %1, <i32 123345, i32 123345, i32 123345, i32 123345> 22 %3 = add nsw <4 x i32> %2, <i32 112, i32 112, i32 112, i32 112> 23 %4 = xor <4 x i32> %3, <i32 543345, i32 543345, i32 543345, i32 543345> 24 %5 = add nsw <4 x i32> %4, <i32 73, i32 73, i32 73, i32 73> 25 %6 = xor <4 x i32> %5, <i32 345987, i32 345987, i32 345987, i32 345987> 26 %7 = add nsw <4 x i32> %6, <i32 48, i32 48, i32 48, i32 48> 27 %8 = xor <4 x i32> %7, <i32 123987, i32 123987, i32 123987, i32 123987> 28 store <4 x i32> %8, ptr %0, align 16 29 %index.next = add i32 %index, 4 30 %9 = icmp eq i32 %index.next, 32 31 br i1 %9, label %middle.block, label %vector.body 32 33middle.block: 34 ret i32 0 35 36; We can't fold the spill into a padd unless the stack is aligned. Just spilling 37; doesn't force stack realignment though 38; UNALIGNED-LABEL: @test1 39; UNALIGNED-NOT: andl $-{{..}}, %esp 40; UNALIGNED: movdqu {{.*}} # 16-byte Spill 41; UNALIGNED-NOT: paddd {{.*}} # 16-byte Folded Reload 42 43; ALIGNED-LABEL: @test1 44; ALIGNED-NOT: andl $-{{..}}, %esp 45; ALIGNED: movdqa {{.*}} # 16-byte Spill 46; ALIGNED: paddd {{.*}} # 16-byte Folded Reload 47 48; FORCEALIGNED-LABEL: @test1 49; FORCEALIGNED: andl $-{{..}}, %esp 50; FORCEALIGNED: movdqa {{.*}} # 16-byte Spill 51; FORCEALIGNED: paddd {{.*}} # 16-byte Folded Reload 52} 53!llvm.module.flags = !{!0} 54;--- align4.ll 55!0 = !{i32 2, !"override-stack-alignment", i32 4} 56;--- align16.ll 57!0 = !{i32 2, !"override-stack-alignment", i32 16} 58