[clang] [CIR] Add HLSL to LangOptions in #cir.lowering_lang_options (PR #230964)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 11 07:03:04 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clangir
Author: Amr Hesham (AmrDeveloper)
<details>
<summary>Changes</summary>
Add HLSL LangOptions to the lowering_lang_options to be used when lowering the built-in matrix type
---
Full diff: https://github.com/llvm/llvm-project/pull/230964.diff
5 Files Affected:
- (modified) clang/include/clang/CIR/Dialect/IR/CIRAttrs.td (+3-2)
- (modified) clang/lib/CIR/CodeGen/CIRGenModule.cpp (+1)
- (modified) clang/test/CIR/CodeGen/lowering-lang-options.cpp (+1)
- (modified) clang/test/CIR/IR/lowering-lang-options.cir (+2-2)
- (modified) clang/test/CIR/Transforms/lowering-prepare.cir (+1-1)
``````````diff
diff --git a/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td b/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
index eb4cf65b919c4..74e028c7b529b 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
@@ -2444,7 +2444,7 @@ def CIR_LoweringLangOptionsAttr
width, CXXABI, fp formats, etc.) are rebuilt from `cir.triple` instead.
Each bool field mirrors the like-named `LangOptions` member: `exceptions`,
- `threadsafe_statics`, `cuda`, `cuda_is_device`, `hip`, `gpu_rdc`,
+ `threadsafe_statics`, `cuda`, `cuda_is_device`, `hip`, `hlsl`, `gpu_rdc`,
`openmp` (`LangOpts.OpenMP != 0`; only its on/off state matters), and
`openmp_is_target_device`. `clang_abi_compat` is an `i32` mirroring
`LangOptions::ClangABI`; it is an `i32` rather than a CIR enum because
@@ -2467,6 +2467,7 @@ def CIR_LoweringLangOptionsAttr
"bool":$cuda,
"bool":$cuda_is_device,
"bool":$hip,
+ "bool":$hlsl,
"bool":$gpu_rdc,
"bool":$openmp,
"bool":$openmp_is_target_device,
@@ -2475,7 +2476,7 @@ def CIR_LoweringLangOptionsAttr
let assemblyFormat = [{
`<` struct($exceptions, $threadsafe_statics, $cuda, $cuda_is_device, $hip,
- $gpu_rdc, $openmp, $openmp_is_target_device,
+ $hlsl, $gpu_rdc, $openmp, $openmp_is_target_device,
$clang_abi_compat) `>`
}];
diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
index 1f80f4e0ebf08..9e5ba96c2b5dd 100644
--- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
@@ -182,6 +182,7 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &mlirContext,
/*cuda=*/langOpts.CUDA,
/*cuda_is_device=*/langOpts.CUDAIsDevice,
/*hip=*/langOpts.HIP,
+ /*hlsl=*/langOpts.HLSL,
/*gpu_rdc=*/langOpts.GPURelocatableDeviceCode,
/*openmp=*/langOpts.OpenMP != 0,
/*openmp_is_target_device=*/langOpts.OpenMPIsTargetDevice,
diff --git a/clang/test/CIR/CodeGen/lowering-lang-options.cpp b/clang/test/CIR/CodeGen/lowering-lang-options.cpp
index 196577428208a..d547e3dce4781 100644
--- a/clang/test/CIR/CodeGen/lowering-lang-options.cpp
+++ b/clang/test/CIR/CodeGen/lowering-lang-options.cpp
@@ -20,6 +20,7 @@ int x;
// PLAIN-SAME: cuda = false
// PLAIN-SAME: cuda_is_device = false
// PLAIN-SAME: hip = false
+// PLAIN-SAME: hlsl = false
// PLAIN-SAME: gpu_rdc = false
// PLAIN-SAME: openmp = false
// PLAIN-SAME: openmp_is_target_device = false
diff --git a/clang/test/CIR/IR/lowering-lang-options.cir b/clang/test/CIR/IR/lowering-lang-options.cir
index 2ef90bd94ed4e..cb1c82eb3d101 100644
--- a/clang/test/CIR/IR/lowering-lang-options.cir
+++ b/clang/test/CIR/IR/lowering-lang-options.cir
@@ -6,11 +6,11 @@
module attributes {cir.lowering_lang_options = #cir.lowering_lang_options<
exceptions = true, threadsafe_statics = false, cuda = true,
- cuda_is_device = true, hip = true, gpu_rdc = true, openmp = true,
+ cuda_is_device = true, hip = true, hlsl = true, gpu_rdc = true, openmp = true,
openmp_is_target_device = true, clang_abi_compat = 9>} {
}
// CHECK: cir.lowering_lang_options = #cir.lowering_lang_options<
// CHECK-SAME: exceptions = true, threadsafe_statics = false, cuda = true,
-// CHECK-SAME: cuda_is_device = true, hip = true, gpu_rdc = true, openmp = true,
+// CHECK-SAME: cuda_is_device = true, hip = true, hlsl = true, gpu_rdc = true, openmp = true,
// CHECK-SAME: openmp_is_target_device = true, clang_abi_compat = 9>
diff --git a/clang/test/CIR/Transforms/lowering-prepare.cir b/clang/test/CIR/Transforms/lowering-prepare.cir
index 6f29fca8c5723..d535eb0df6768 100644
--- a/clang/test/CIR/Transforms/lowering-prepare.cir
+++ b/clang/test/CIR/Transforms/lowering-prepare.cir
@@ -11,7 +11,7 @@ module attributes {
cir.triple = "x86_64-unknown-linux-gnu",
cir.lowering_lang_options = #cir.lowering_lang_options<
exceptions = false, threadsafe_statics = true, cuda = false,
- cuda_is_device = false, hip = false, gpu_rdc = false, openmp = false,
+ cuda_is_device = false, hip = false, hlsl = false, gpu_rdc = false, openmp = false,
openmp_is_target_device = false, clang_abi_compat = 16>
} {
cir.global "private" internal dso_local dynamic_init_guard<"_ZGVZ1gvE1x"> @_ZZ1gvE1x = #cir.int<0> : !s32i align(4) dynamic_init_info<local = true, tls = none, is_inline = false, tsk = undeclared>
``````````
</details>
https://github.com/llvm/llvm-project/pull/230964
More information about the cfe-commits
mailing list