1; RUN: opt -S -loop-vectorize -instcombine -force-vector-width=4 -force-vector-interleave=1 -enable-interleaved-mem-accesses=true -runtime-memory-check-threshold=24 --pass-remarks=loop-vectorize < %s | FileCheck %s
2
3target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
4
5
6; This only tests that asking for remarks doesn't lead to compiler crashing
7; (or timing out). We just check for output. To be sure, we also check we didn't
8; vectorize.
9; CHECK-LABEL: @atomicLoadsBothWriteAndReadMem
10; CHECK-NOT: <{{[0-9]+}} x i8>
11
12%"struct.std::__atomic_base" = type { i32 }
13%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
14%union.anon = type { i64 }
15%MyStruct = type { i32, %"struct.std::atomic", %union.anon }
16
17define void @atomicLoadsBothWriteAndReadMem(%MyStruct *%a, %MyStruct *%b, %MyStruct *%lim) {
18entry:
19  br label %loop
20
21loop:
22  %0 = phi %MyStruct* [ %a, %entry ], [ %ainc, %loop ]
23  %1 = phi %MyStruct* [ %b, %entry ], [ %binc, %loop ]
24  %2 = getelementptr %MyStruct, %MyStruct* %1, i64 0, i32 0
25  %3 = load i32, i32* %2, align 8
26  %4 = getelementptr inbounds %MyStruct, %MyStruct* %0, i64 0, i32 0
27  store i32 %3, i32* %4, align 8
28  %5 = getelementptr inbounds %MyStruct, %MyStruct* %1, i64 0, i32 1, i32 0, i32 0
29  %6 = load atomic i32, i32* %5 monotonic, align 4
30  %7 = getelementptr inbounds %MyStruct, %MyStruct* %0, i64 0, i32 1, i32 0, i32 0
31  store atomic i32 %6, i32* %7 monotonic, align 4
32  %8 = getelementptr inbounds %MyStruct, %MyStruct* %1, i64 0, i32 2, i32 0
33  %9 = getelementptr inbounds %MyStruct, %MyStruct* %0, i64 0, i32 2, i32 0
34  %10 = load i64, i64* %8, align 8
35  store i64 %10, i64* %9, align 8
36  %binc = getelementptr inbounds %MyStruct, %MyStruct* %1, i64 1
37  %ainc = getelementptr inbounds %MyStruct, %MyStruct* %0, i64 1
38  %cond = icmp eq %MyStruct* %binc, %lim
39  br i1 %cond, label %exit, label %loop
40
41exit:
42  ret void
43}
44