mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-09 08:56:06 +00:00

Since C++11, the C++ standard has a forward progress guarantee [intro.progress], so all such functions must have the `mustprogress` requirement. In addition, from C11 and onwards, loops without a non-zero constant conditional or no conditional are also required to make progress (C11 6.8.5p6). This patch implements these attribute deductions so they can be used by the optimization passes. Differential Revision: https://reviews.llvm.org/D86841
23 lines
1.0 KiB
C++
23 lines
1.0 KiB
C++
// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm -o - %s | FileCheck %s
|
|
|
|
// Verify that the outer loop has the inner loop's access in its
|
|
// llvm.loop.parallel_accesses property.
|
|
void vectorize_outer_test(int *List, int Length) {
|
|
#pragma clang loop vectorize(assume_safety) interleave(disable) unroll(disable)
|
|
for (int i = 0; i < Length; i += 2) {
|
|
#pragma clang loop unroll(full)
|
|
for (int j = 0; j < 2; j += 1)
|
|
List[i + j] = (i + j) * 2;
|
|
}
|
|
}
|
|
|
|
// CHECK: %[[MUL:.+]] = mul
|
|
// CHECK: store i32 %[[MUL]], i32* %{{.+}}, !llvm.access.group ![[ACCESS_GROUP_2:[0-9]+]]
|
|
// CHECK: br label %{{.+}}, !llvm.loop ![[INNER_LOOPID:[0-9]+]]
|
|
// CHECK: br label %{{.+}}, !llvm.loop ![[OUTER_LOOPID:[0-9]+]]
|
|
|
|
// CHECK: ![[ACCESS_GROUP_2]] = distinct !{}
|
|
// CHECK: ![[INNER_LOOPID]] = distinct !{![[INNER_LOOPID]],
|
|
// CHECK: ![[OUTER_LOOPID]] = distinct !{![[OUTER_LOOPID]], [[MP:![0-9]+]], ![[PARALLEL_ACCESSES_9:[0-9]+]]
|
|
// CHECK: ![[PARALLEL_ACCESSES_9]] = !{!"llvm.loop.parallel_accesses", ![[ACCESS_GROUP_2]]}
|