Files
RedBear-OS/local/recipes/dev/libclc/source/llvm/test/Bitcode/metadata-function-blocks.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

79 lines
2.2 KiB
LLVM

; RUN: llvm-as < %s -bitcode-mdindex-threshold=0 | llvm-bcanalyzer -dump | FileCheck %s
; Test that metadata only used by a single function is serialized in that
; function instead of in the global pool.
;
; In order to make the bitcode records easy to follow, nodes in this testcase
; are named after the ids they are given in the bitcode. Nodes local to a
; function have offsets of 100 or 200 (depending on the function) so that they
; remain unique within this textual IR.
; Check for strings in the global pool.
; CHECK: <METADATA_BLOCK
; CHECK-NEXT: <STRINGS
; CHECK-SAME: /> num-strings = 3 {
; CHECK-NEXT: 'named'
; CHECK-NEXT: 'named and foo'
; CHECK-NEXT: 'foo and bar'
; CHECK-NEXT: }
; Each node gets a new number. Bottom-up traversal of nodes.
!named = !{!6}
; Before the records we emit an offset to the index for the block
; CHECK-NEXT: <INDEX_OFFSET
; CHECK-NEXT: <NODE op0=1/>
!4 = !{!"named"}
; CHECK-NEXT: <NODE op0=2/>
!5 = !{!"named and foo"}
; CHECK-NEXT: <NODE op0=1 op1=4 op2=5/>
!6 = !{!"named", !4, !5}
; CHECK-NEXT: <NODE op0=3/>
!7 = !{!"foo and bar"}
; CHECK-NOT: <NODE
; CHECK: </METADATA_BLOCK
; Look at metadata local to @foo, starting with strings.
; CHECK: <FUNCTION_BLOCK
; CHECK: <METADATA_BLOCK
; CHECK-NEXT: <STRINGS
; CHECK-SAME: /> num-strings = 1 {
; CHECK-NEXT: 'foo'
; CHECK-NEXT: }
; Function-local nodes start at 9 (strings at 8).
; CHECK-NEXT: <NODE op0=8/>
!109 = !{!"foo"}
; CHECK-NEXT: <NODE op0=8 op1=3 op2=9 op3=7 op4=5/>
!110 = !{!"foo", !"foo and bar", !109, !7, !5}
; CHECK-NEXT: </METADATA_BLOCK
define void @foo() !foo !110 {
unreachable
}
; Look at metadata local to @bar, starting with strings.
; CHECK: <FUNCTION_BLOCK
; CHECK: <METADATA_BLOCK
; CHECK-NEXT: <STRINGS
; CHECK-SAME: /> num-strings = 1 {
; CHECK-NEXT: 'bar'
; CHECK-NEXT: }
; Function-local nodes start at 9 (strings at 8).
; CHECK-NEXT: <NODE op0=8/>
!209 = !{!"bar"}
; CHECK-NEXT: <NODE op0=8 op1=3 op2=9 op3=7/>
!210 = !{!"bar", !"foo and bar", !209, !7}
; CHECK-NEXT: </METADATA_BLOCK
define void @bar() {
unreachable, !bar !210
}