[flang-commits] [flang] [flang] Add LLVM dialect dependency to VScaleAttr (PR #213931)
Keshav Vinayak Jha via flang-commits
flang-commits at lists.llvm.org
Tue Aug 4 06:19:48 PDT 2026
https://github.com/keshavvinayak01 updated https://github.com/llvm/llvm-project/pull/213931
>From f20f19021dd37c1f8e8d33a2a536ecd3c3052643 Mon Sep 17 00:00:00 2001
From: Keshav Vinayak Jha <keshavvinayakjha at gmail.com>
Date: Tue, 4 Aug 2026 18:38:32 +0530
Subject: [PATCH] [flang] Add LLVM dialect dependency to VScaleAttr
VScaleAttr creates an LLVM VScaleRangeAttr, but did not declare the LLVM dialect as a pass dependency. This aborts when the input does not otherwise load LLVM.
Declare the dependency and remove the masking FIR type from the existing test input.
Signed-off-by: Keshav Vinayak Jha <keshavvinayakjha at gmail.com>
---
flang/include/flang/Optimizer/Transforms/Passes.td | 1 +
flang/test/Transforms/vscale-attr.fir | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/flang/include/flang/Optimizer/Transforms/Passes.td b/flang/include/flang/Optimizer/Transforms/Passes.td
index 9a1357881eae0..e7bb8ae9bb9bf 100644
--- a/flang/include/flang/Optimizer/Transforms/Passes.td
+++ b/flang/include/flang/Optimizer/Transforms/Passes.td
@@ -426,6 +426,7 @@ def VScaleAttr : Pass<"vscale-attr", "mlir::func::FuncOp"> {
Set an attribute for the vscale range on functions, to allow scalable
vector operations to be used on processors with variable vector length.
}];
+ let dependentDialects = ["mlir::LLVM::LLVMDialect"];
let options = [Option<"vscaleMin", "vscale-min", "unsigned", /*default=*/"1",
"vector scale minimum value. Defaults to \"1\"">,
Option<"vscaleMax", "vscale-max", "unsigned", /*default=*/"0",
diff --git a/flang/test/Transforms/vscale-attr.fir b/flang/test/Transforms/vscale-attr.fir
index 146b1af7c489f..657f6feb067fe 100644
--- a/flang/test/Transforms/vscale-attr.fir
+++ b/flang/test/Transforms/vscale-attr.fir
@@ -19,6 +19,6 @@
// 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"}) {
+func.func @_QPtest() {
return
}
More information about the flang-commits
mailing list