1 ; RUN: opt -S -passes=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
3 target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
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
9 ; CHECK-LABEL: @atomicLoadsBothWriteAndReadMem
10 ; CHECK-NOT: <{{[0-9]+}} x i8>
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 }
17 define void @atomicLoadsBothWriteAndReadMem(ptr %a, ptr %b, ptr %lim) {
22 %0 = phi ptr [ %a, %entry ], [ %ainc, %loop ]
23 %1 = phi ptr [ %b, %entry ], [ %binc, %loop ]
24 %2 = load i32, ptr %1, align 8
25 store i32 %2, ptr %0, align 8
26 %3 = getelementptr inbounds %MyStruct, ptr %1, i64 0, i32 1, i32 0, i32 0
27 %4 = load atomic i32, ptr %3 monotonic, align 4
28 %5 = getelementptr inbounds %MyStruct, ptr %0, i64 0, i32 1, i32 0, i32 0
29 store atomic i32 %4, ptr %5 monotonic, align 4
30 %6 = getelementptr inbounds %MyStruct, ptr %1, i64 0, i32 2, i32 0
31 %7 = getelementptr inbounds %MyStruct, ptr %0, i64 0, i32 2, i32 0
32 %8 = load i64, ptr %6, align 8
33 store i64 %8, ptr %7, align 8
34 %binc = getelementptr inbounds %MyStruct, ptr %1, i64 1
35 %ainc = getelementptr inbounds %MyStruct, ptr %0, i64 1
36 %cond = icmp eq ptr %binc, %lim
37 br i1 %cond, label %exit, label %loop