Files
RedBear-OS/local/recipes/dev/libclc/source/llvm/test/Verifier/preallocated-valid.ll
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

74 lines
2.5 KiB
LLVM

; RUN: opt -S %s -passes=verify
declare token @llvm.call.preallocated.setup(i32)
declare ptr @llvm.call.preallocated.arg(token, i32)
declare void @llvm.call.preallocated.teardown(token)
declare i32 @__CxxFrameHandler3(...)
declare void @foo1(ptr preallocated(i32))
declare i64 @foo1_i64(ptr preallocated(i32))
declare void @foo2(ptr preallocated(i32), ptr, ptr preallocated(i32))
declare void @constructor(ptr)
define void @preallocated() {
%cs = call token @llvm.call.preallocated.setup(i32 1)
%x = call ptr @llvm.call.preallocated.arg(token %cs, i32 0) preallocated(i32)
call void @foo1(ptr preallocated(i32) %x) ["preallocated"(token %cs)]
ret void
}
define void @preallocated_indirect(ptr %f) {
%cs = call token @llvm.call.preallocated.setup(i32 1)
%x = call ptr @llvm.call.preallocated.arg(token %cs, i32 0) preallocated(i32)
call void %f(ptr preallocated(i32) %x) ["preallocated"(token %cs)]
ret void
}
define void @preallocated_setup_without_call() {
%cs = call token @llvm.call.preallocated.setup(i32 1)
%a0 = call ptr @llvm.call.preallocated.arg(token %cs, i32 0) preallocated(i32)
ret void
}
define void @preallocated_num_args() {
%cs = call token @llvm.call.preallocated.setup(i32 2)
%x = call ptr @llvm.call.preallocated.arg(token %cs, i32 0) preallocated(i32)
%y = call ptr @llvm.call.preallocated.arg(token %cs, i32 1) preallocated(i32)
%a = inttoptr i32 0 to ptr
call void @foo2(ptr preallocated(i32) %x, ptr %a, ptr preallocated(i32) %y) ["preallocated"(token %cs)]
ret void
}
define void @preallocated_musttail(ptr preallocated(i32) %a) {
musttail call void @foo1(ptr preallocated(i32) %a)
ret void
}
define i64 @preallocated_musttail_i64(ptr preallocated(i32) %a) {
%r = musttail call i64 @foo1_i64(ptr preallocated(i32) %a)
ret i64 %r
}
define void @preallocated_teardown() {
%cs = call token @llvm.call.preallocated.setup(i32 1)
call void @llvm.call.preallocated.teardown(token %cs)
ret void
}
define void @preallocated_teardown_invoke() personality ptr @__CxxFrameHandler3 {
%cs = call token @llvm.call.preallocated.setup(i32 1)
%x = call ptr @llvm.call.preallocated.arg(token %cs, i32 0) preallocated(i32)
invoke void @constructor(ptr %x) to label %conta unwind label %contb
conta:
call void @foo1(ptr preallocated(i32) %x) ["preallocated"(token %cs)]
ret void
contb:
%s = catchswitch within none [label %catch] unwind to caller
catch:
%p = catchpad within %s []
call void @llvm.call.preallocated.teardown(token %cs)
ret void
}