cb424d7448
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).
70 lines
1.8 KiB
Plaintext
70 lines
1.8 KiB
Plaintext
// Test lowering FIR to LLVM IR of fir.select{|_rank|_case}
|
|
|
|
// RUN: tco %s | FileCheck %s
|
|
// RUN: %flang_fc1 -emit-llvm %s -o - | FileCheck %s
|
|
|
|
// CHECK-LABEL: @f
|
|
func.func @f(%a : i32) -> i32 {
|
|
%1 = arith.constant 1 : i32
|
|
%2 = arith.constant 42 : i32
|
|
// CHECK: switch i32 %{{.*}}, label %{{.*}} [
|
|
// CHECK: i32 1, label %{{.*}}
|
|
// CHECK: ]
|
|
fir.select %a : i32 [1, ^bb2(%1:i32), unit, ^bb3(%2:i32)]
|
|
^bb2(%3 : i32) :
|
|
return %3 : i32
|
|
^bb3(%4 : i32) :
|
|
%5 = arith.addi %4, %4 : i32
|
|
// CHECK: ret i32
|
|
return %5 : i32
|
|
}
|
|
|
|
// CHECK-LABEL: @g
|
|
func.func @g(%a : i32) -> i32 {
|
|
%1 = arith.constant 1 : i32
|
|
%2 = arith.constant 42 : i32
|
|
|
|
// CHECK: switch i32 %{{.*}}, label %{{.*}} [
|
|
// CHECK: i32 1, label %{{.*}}
|
|
// CHECK: i32 -1, label %{{.*}}
|
|
// CHECK: ]
|
|
fir.select_rank %a : i32 [1, ^bb2(%1:i32), -1, ^bb4, unit, ^bb3(%2:i32)]
|
|
^bb2(%3 : i32) :
|
|
return %3 : i32
|
|
^bb3(%4 : i32) :
|
|
%5 = arith.addi %4, %4 : i32
|
|
return %5 : i32
|
|
^bb4:
|
|
// CHECK: ret i32
|
|
return %a : i32
|
|
}
|
|
|
|
// CHECK-LABEL: @h
|
|
func.func @h(%a : i32) -> i32 {
|
|
%1 = arith.constant 1 : i32
|
|
%2 = arith.constant 42 : i32
|
|
%b1 = arith.constant 4 : i32
|
|
%b2 = arith.constant 14 : i32
|
|
%b3 = arith.constant 82 : i32
|
|
%b4 = arith.constant 96 : i32
|
|
// CHECK-DAG: icmp eq i32 %{{.*}}, 1
|
|
// CHECK-DAG: icmp sle i32 4, %{{.*}}
|
|
// CHECK-DAG: icmp sle i32 %{{.*}}, 14
|
|
// CHECK-DAG: icmp sle i32 82, %{{.*}}
|
|
// CHECK-DAG: icmp sle i32 %{{.*}}, 96
|
|
fir.select_case %a : i32 [#fir.point, %1, ^bb2(%1:i32), #fir.lower, %b1, ^bb4, #fir.upper, %b2, ^bb6, #fir.interval, %b3, %b4, ^bb5, unit, ^bb3(%2:i32)]
|
|
^bb2(%3 : i32) :
|
|
return %3 : i32
|
|
^bb3(%4 : i32) :
|
|
%5 = arith.addi %4, %4 : i32
|
|
cf.br ^bb2(%5 : i32)
|
|
^bb4:
|
|
return %a : i32
|
|
^bb5:
|
|
return %1 : i32
|
|
^bb6:
|
|
%x = arith.addi %b4, %b3 : i32
|
|
// CHECK: ret i32
|
|
return %x : i32
|
|
}
|