• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mcpu=btver2 %s -o - | FileCheck %s
3; Test desc: two functions (foo, bar) with byval arguments, should not have
4; reads/writes from/to byval storage re-ordered.
5; When broken, five "1" constants are written into the byval %struct.face,
6; but the subsequent byval read of that struct (call to bar) gets re-ordered
7; before those writes, illegally.
8source_filename = "test.c"
9target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
10target triple = "x86_64-pc-linux-gnu"
11
12%struct.face = type { [7 x i32] }
13
14; Function Attrs: noinline nounwind uwtable
15declare void @bar(%struct.face* byval nocapture readonly align 8);
16
17; Function Attrs: noinline nounwind uwtable
18define void @foo(%struct.face* byval nocapture align 8) local_unnamed_addr {
19; CHECK-LABEL: foo:
20; CHECK:       # %bb.0:
21; CHECK-NEXT:    subq $40, %rsp
22; CHECK-NEXT:    .cfi_def_cfa_offset 48
23; CHECK-NEXT:    vmovaps {{.*#+}} xmm0 = [1,1,1,1]
24; CHECK-NEXT:    vmovaps %xmm0, {{[0-9]+}}(%rsp)
25; CHECK-NEXT:    movl $1, {{[0-9]+}}(%rsp)
26; CHECK-NEXT:    vmovups {{[0-9]+}}(%rsp), %xmm0
27; CHECK-NEXT:    vmovups %xmm0, {{[0-9]+}}(%rsp)
28; CHECK-NEXT:    vmovaps {{[0-9]+}}(%rsp), %xmm0
29; CHECK-NEXT:    vmovups %xmm0, (%rsp)
30; CHECK-NEXT:    callq bar
31; CHECK-NEXT:    addq $40, %rsp
32; CHECK-NEXT:    .cfi_def_cfa_offset 8
33; CHECK-NEXT:    retq
34  %2 = bitcast %struct.face* %0 to <4 x i32>*
35  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %2, align 8
36  %3 = getelementptr inbounds %struct.face, %struct.face* %0, i64 0, i32 0, i64 4
37  store i32 1, i32* %3, align 8
38  call void @bar(%struct.face* byval nonnull align 8 %0)
39  ret void
40}
41