Files
RedBear-OS/local/recipes/dev/libclc/source/clang/test/CodeGenCXX/pragma-loop-pr27643.cpp
T
vasilito cb424d7448 build: static patch-sanity linter (shift-left the malformed-patch class)
verify-patch-sanity.py validates every active recipe .patch has internally-
consistent hunk line counts — catching the 'malformed patch at line N' failure
at commit/CI/preflight time instead of hours into a cook. This cycle hit that
class three times (qtwaylandscanner, sddm, xwayland), each only discovered when
cookbook tried to apply the patch.

Running it across the repo found 29 latent malformed patches (validated against
GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22').
They were harmless only because they sit in vendored recipes (baked, not re-
applied) — but would fail on any version-bump re-derivation. --fix recounts the
hunk headers (body untouched) and repaired all 29.

Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test
(test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats
(empty placeholders, bare-@@ git hunks).
2026-08-01 05:13:02 +03:00

54 lines
1.9 KiB
C++

// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm -o - %s | FileCheck %s
void loop1(int *List, int Length) {
// CHECK-LABEL: @{{.*}}loop1{{.*}}(
// CHECK: br label {{.*}}, !llvm.loop ![[LOOP1:.*]]
#pragma clang loop vectorize(enable) vectorize_width(1)
for (int i = 0; i < Length; i++)
List[i] = i * 2;
}
// Here, vectorize.enable should be set, obviously, but also check that
// metadata isn't added twice.
void loop2(int *List, int Length) {
// CHECK-LABEL: @{{.*}}loop2{{.*}}(
// CHECK: br label {{.*}}, !llvm.loop ![[LOOP2:.*]]
#pragma clang loop vectorize(enable) vectorize_width(2)
for (int i = 0; i < Length; i++)
List[i] = i * 2;
}
// Test that we do *not* imply vectorize.enable.
void loop3(int *List, int Length) {
// CHECK-LABEL: @{{.*}}loop3{{.*}}(
// CHECK: br label {{.*}}, !llvm.loop ![[LOOP3:.*]]
#pragma clang loop vectorize_width(1)
for (int i = 0; i < Length; i++)
List[i] = i * 2;
}
// Test that we *do* imply vectorize.enable.
void loop4(int *List, int Length) {
// CHECK-LABEL: @{{.*}}loop4{{.*}}(
// CHECK: br label {{.*}}, !llvm.loop ![[LOOP4:.*]]
#pragma clang loop vectorize_width(2)
for (int i = 0; i < Length; i++)
List[i] = i * 2;
}
// CHECK: ![[LOOP1]] = distinct !{![[LOOP1]], [[MP:![0-9]+]], ![[VEC_WIDTH_1:.*]], ![[FIXED_WIDTH:.*]], ![[VEC_ENABLE:.*]]}
// CHECK: ![[VEC_WIDTH_1]] = !{!"llvm.loop.vectorize.width", i32 1}
// CHECK: ![[FIXED_WIDTH]] = !{!"llvm.loop.vectorize.scalable.enable", i1 false}
// CHECK: ![[VEC_ENABLE]] = !{!"llvm.loop.vectorize.enable", i1 true}
// CHECK: ![[LOOP2]] = distinct !{![[LOOP2]], [[MP]], ![[VEC_WIDTH_2:.*]], ![[FIXED_WIDTH:.*]], ![[VEC_ENABLE]]}
// CHECK: ![[VEC_WIDTH_2]] = !{!"llvm.loop.vectorize.width", i32 2}
// CHECK: ![[LOOP3]] = distinct !{![[LOOP3]], [[MP]], ![[VEC_WIDTH_1]], ![[FIXED_WIDTH]]}
// CHECK: ![[LOOP4]] = distinct !{![[LOOP4]], [[MP]], ![[VEC_WIDTH_2]], ![[FIXED_WIDTH]], ![[VEC_ENABLE]]}