[clang] 52d7ce0 - [HLSL] Allow SV_GroupIndex for lib profile.
Xiang Li via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 21 12:30:09 PDT 2022
Author: Xiang Li
Date: 2022-09-21T12:29:58-07:00
New Revision: 52d7ce0cc1a57123ee27a0bff0530f89cab99ab7
URL: https://github.com/llvm/llvm-project/commit/52d7ce0cc1a57123ee27a0bff0530f89cab99ab7
DIFF: https://github.com/llvm/llvm-project/commit/52d7ce0cc1a57123ee27a0bff0530f89cab99ab7.diff
LOG: [HLSL] Allow SV_GroupIndex for lib profile.
Lib profile could include all kind of entry functions.
Reviewed By: beanz
Differential Revision: https://reviews.llvm.org/D134326
Added:
Modified:
clang/lib/Sema/SemaDeclAttr.cpp
clang/test/CodeGenHLSL/GlobalDestructors.hlsl
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 128eefbf7197b..b7c233c8f4240 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -6895,7 +6895,10 @@ HLSLNumThreadsAttr *Sema::mergeHLSLNumThreadsAttr(Decl *D,
static void handleHLSLSVGroupIndexAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
using llvm::Triple;
Triple Target = S.Context.getTargetInfo().getTriple();
- if (Target.getEnvironment() != Triple::Compute) {
+ if (Target.getEnvironment() != Triple::Compute &&
+ Target.getEnvironment() != Triple::Library) {
+ // FIXME: it is OK for a compute shader entry and pixel shader entry live in
+ // same HLSL file. Issue https://github.com/llvm/llvm-project/issues/57880.
uint32_t Pipeline =
(uint32_t)S.Context.getTargetInfo().getTriple().getEnvironment() -
(uint32_t)llvm::Triple::Pixel;
diff --git a/clang/test/CodeGenHLSL/GlobalDestructors.hlsl b/clang/test/CodeGenHLSL/GlobalDestructors.hlsl
index ece040fa633b9..6d618ff18eb22 100644
--- a/clang/test/CodeGenHLSL/GlobalDestructors.hlsl
+++ b/clang/test/CodeGenHLSL/GlobalDestructors.hlsl
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -std=hlsl202x -S -emit-llvm -disable-llvm-passes %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -std=hlsl202x -S -emit-llvm -disable-llvm-passes %s -o - | FileCheck %s --check-prefixes=CHECK
struct Tail {
Tail() {
More information about the cfe-commits
mailing list