Refactor how `func.func` discardable attributes are handled in the Func-to-LLVM conversion. Instead of ad hoc checks for linkage and readnone followed by a simple filter, the pass now generically processes inherent attributes from LLVMFuncOp. Attributes that correspond to inherent `llvm.func` ODS names can be attached as `llvm.<name>` on `func.func` and are stripped to `<name>` when building `LLVM::LLVMFuncOp`, so LLVM-specific knobs stay namespaced on the source op but land on the right inherent slots on `llvm.func`. Other discardable attributes continue to be propagated as-is. Fixes #175959 Fixes #181464 Assisted-by: CLion code completion, GPT 5.3-Codex --------- Co-authored-by: Mehdi Amini <joker.eph@gmail.com>
25 lines
1.9 KiB
Plaintext
25 lines
1.9 KiB
Plaintext
// RUN: fir-opt --vscale-attr %s | FileCheck %s --check-prefix=CHECK-DEFAULT
|
|
// RUN: fir-opt --vscale-attr="vscale-min=4" %s | FileCheck %s --check-prefix=CHECK-MIN
|
|
// RUN: fir-opt --vscale-attr="vscale-max=16" %s | FileCheck %s --check-prefix=CHECK-MAX
|
|
// RUN: fir-opt --vscale-attr="vscale-min=8 vscale-max=16" %s | FileCheck %s --check-prefix=CHECK-BOTH
|
|
// RUN: fir-opt --vscale-attr="vscale-min=8 vscale-max=8" %s | FileCheck %s --check-prefix=CHECK-EQUAL
|
|
// RUN: not fir-opt --vscale-attr="vscale-min=0 vscale-max=4" %s 2>&1 | FileCheck %s --check-prefix=VSCALE-MIN-0
|
|
// RUN: not fir-opt --vscale-attr="vscale-min=3 vscale-max=4" %s 2>&1 | FileCheck %s --check-prefix=VSCALE-MIN-NO-PO2
|
|
// RUN: not fir-opt --vscale-attr="vscale-max=6" %s 2>&1 | FileCheck %s --check-prefix=VSCALE-MAX-NO-PO2
|
|
// RUN: not fir-opt --vscale-attr="vscale-min=16 vscale-max=8" %s 2>&1 | FileCheck %s --check-prefix=VSCALE-MIN-GREATER
|
|
|
|
|
|
// CHECK-DEFAULT: attributes {llvm.vscale_range = #llvm.vscale_range<minRange = 1 : i32, maxRange = 0 : i32>}
|
|
// CHECK-MIN: attributes {llvm.vscale_range = #llvm.vscale_range<minRange = 4 : i32, maxRange = 0 : i32>}
|
|
// CHECK-MAX: attributes {llvm.vscale_range = #llvm.vscale_range<minRange = 1 : i32, maxRange = 16 : i32>}
|
|
// CHECK-BOTH: attributes {llvm.vscale_range = #llvm.vscale_range<minRange = 8 : i32, maxRange = 16 : i32>}
|
|
// CHECK-EQUAL: attributes {llvm.vscale_range = #llvm.vscale_range<minRange = 8 : i32, maxRange = 8 : i32>}
|
|
|
|
// VSCALE-MIN-0: VScaleAttr: vscaleMin has to be a power-of-two greater than 0
|
|
// VSCALE-MIN-NO-PO2: VScaleAttr: vscaleMin has to be a power-of-two greater than 0
|
|
// VSCALE-MAX-NO-PO2: VScaleAttr: vscaleMax has to be a power-of-two greater-than-or-equal to vscaleMin or 0 to signify an unbounded maximum
|
|
// VSCALE-MIN-GREATER: VScaleAttr: vscaleMax has to be a power-of-two greater-than-or-equal to vscaleMin or 0 to signify an unbounded maximum
|
|
func.func @_QPtest(%arg0: !fir.ref<i32> {fir.bindc_name = "x"}) {
|
|
return
|
|
}
|