[clang] [HLSL] Add implicit resource element type concepts to AST (PR #112600)

2024-11-13 Thread Chris B via cfe-commits
@@ -483,10 +583,103 @@ static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema &S, .addDefaultHandleConstructor(S, RC); } +BinaryOperator *constructSizeOfLEQ16Expr(ASTContext &Context, + SourceLocation NameLoc, +

[clang] [HLSL] Add implicit resource element type concepts to AST (PR #112600)

2024-11-13 Thread Chris B via cfe-commits
@@ -483,10 +583,103 @@ static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema &S, .addDefaultHandleConstructor(S, RC); } +BinaryOperator *constructSizeOfLEQ16Expr(ASTContext &Context, + SourceLocation NameLoc, +

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-12-03 Thread Chris B via cfe-commits
@@ -1206,6 +1202,21 @@ class SPIRVStructurizer : public FunctionPass { AU.addPreserved(); FunctionPass::getAnalysisUsage(AU); } + + void createOpSelectMerge(IRBuilder<> *Builder, BlockAddress *MergeAddress) { +Instruction *BBTerminatorInst = Builder->GetInsertBlo

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-12-03 Thread Chris B via cfe-commits
@@ -300,6 +301,36 @@ static MDTuple *emitTopLevelLibraryNode(Module &M, MDNode *RMD, return constructEntryMetadata(nullptr, nullptr, RMD, Properties, Ctx); } +// TODO: We might need to refactor this to be more generic, +// in case we need more metadata to be replaced. +stat

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-12-03 Thread Chris B via cfe-commits
@@ -2694,19 +2694,49 @@ bool SPIRVInstructionSelector::selectIntrinsic(Register ResVReg, } return MIB.constrainAllUses(TII, TRI, RBI); } - case Intrinsic::spv_loop_merge: - case Intrinsic::spv_selection_merge: { -const auto Opcode = IID == Intrinsic::spv_select

[clang] [HLSL] get inout/out ABI for array parameters working (PR #111047)

2024-12-03 Thread Chris B via cfe-commits
@@ -5322,6 +5324,11 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, IRCallArgs[FirstIRArg] = Val; break; } + } else if (I->getType()->isArrayParameterType()) { +// use the tmp created by the HLSLOutArgExpr +/

[clang] [HLSL] get inout/out ABI for array parameters working (PR #111047)

2024-12-03 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/111047 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clangd] Consolidate two functions converting index to LSP locations (PR #117885)

2024-12-03 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/117885 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Fix debug info generation for RWBuffer types (PR #119041)

2024-12-09 Thread Chris B via cfe-commits
@@ -2021,28 +2021,10 @@ llvm::DISubroutineType *CGDebugInfo::getOrCreateInstanceMethodType( // ThisPtr may be null if the member function has an explicit 'this' // parameter. if (!ThisPtr.isNull()) { -const CXXRecordDecl *RD = ThisPtr->getPointeeCXXRecordDecl(); -

[clang] Add `pragma clang scope [push|pop]` (PR #121025)

2024-12-23 Thread Chris B via cfe-commits
https://github.com/llvm-beanz created https://github.com/llvm/llvm-project/pull/121025 Have you ever had that horrible realization that some header you included defines a macro that matches a commonly used word that appears throughout your codebase? What kind of horrible person would define `m

[clang] [clang] add llvm abi support (PR #121123)

2025-01-06 Thread Chris B via cfe-commits
@@ -1531,7 +1531,7 @@ Compilation *Driver::BuildCompilation(ArrayRef ArgList) { // Check if the environment version is valid except wasm case. llvm::Triple Triple = TC.getTriple(); - if (!Triple.isWasm()) { + if (!Triple.isWasm() && Triple.getEnvironment() != llvm::Tripl

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-06 Thread Chris B via cfe-commits
@@ -1,73 +1,151 @@ -// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \ -// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ -// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ -// RUN: --check-prefixes=CHECK,NATIVE_HALF -// RUN: %clang_cc1 -

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-06 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: I don't love the way you re-wrote clang/test/CodeGenHLSL/builtins/length.hlsl. I'm not a huge fan of the `update_cc_test_checks` workflow, and (as I commented elsewhere) I really don't like tests that depend on optimizations. I'm okay with removing the

[clang] [llvm] [HLSL] Move length support out of the DirectX Backend (PR #121611)

2025-01-06 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/121611 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Fix debug info generation for RWBuffer types (PR #119041)

2025-01-06 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/119041 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][RootSignature] Implement parsing of `RootFlags` (PR #121799)

2025-01-06 Thread Chris B via cfe-commits
@@ -0,0 +1,139 @@ +#include "clang/Sema/ParseHLSLRootSignature.h" + +namespace llvm { +namespace hlsl { +namespace root_signature { + +// TODO: Hook up with Sema to properly report semantic/validation errors +bool Parser::ReportError() { return true; } + +bool Parser::ParseRootFla

[clang] [llvm] [HLSL][RootSignature] Implement parsing of `RootFlags` (PR #121799)

2025-01-06 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: Is there a reason that you're just operating on a StringRef buffer instead of building out a proper tokenizer and parser? It seems to me like root signature parsing probably warrants full lexer and parser that operates on tokens rather than just section

[clang] [llvm] [HLSL][RootSignature] Implement parsing of `RootFlags` (PR #121799)

2025-01-06 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/121799 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2025-01-06 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/116331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Deprecate order file instrumentation (PR #121514)

2025-01-06 Thread Chris B via cfe-commits
@@ -8010,15 +8010,19 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } } - if (Args.hasArg(options::OPT_forder_file_instrumentation)) { - CmdArgs.push_back("-forder-file-instrumentation"); - // Enable order file instrumentation when ThinLTO is

[clang-tools-extra] [clangd] Remove clangd's HasValue GMock matcher (PR #121309)

2025-01-01 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/121309 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][SPIRV][DXIL] Implement `WaveActiveSum` intrinsic (PR #118580)

2025-01-07 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/118580 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL][RootSignature] Implement parsing of `RootFlags` (PR #121799)

2025-01-07 Thread Chris B via cfe-commits
llvm-beanz wrote: > I didn't implement the tokenizer because I found that the extra level of > abstraction to be redundant/not beneficial with the StringRef operations. I disagree, and generally string operations tend to muddy up and can lead to inefficiencies. > Looking at the DXC implementa

[clang] Deprecate order file instrumentation (PR #121514)

2025-01-07 Thread Chris B via cfe-commits
@@ -8010,15 +8010,19 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } } - if (Args.hasArg(options::OPT_forder_file_instrumentation)) { - CmdArgs.push_back("-forder-file-instrumentation"); - // Enable order file instrumentation when ThinLTO is

[clang] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-02-09 Thread Chris B via cfe-commits
@@ -0,0 +1,171 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +namespace clang { +namespace hlsl { + +// Lexer Definitions + +static bool IsNumberChar(char C) { + // TODO(#120472): extend for float support exponents + return isdigit(C); // integer support +} + +bool RootS

[clang] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-02-09 Thread Chris B via cfe-commits
@@ -0,0 +1,171 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +namespace clang { +namespace hlsl { + +// Lexer Definitions + +static bool IsNumberChar(char C) { + // TODO(#120472): extend for float support exponents + return isdigit(C); // integer support +} + +bool RootS

[clang] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-02-09 Thread Chris B via cfe-commits
@@ -0,0 +1,171 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +namespace clang { +namespace hlsl { + +// Lexer Definitions + +static bool IsNumberChar(char C) { + // TODO(#120472): extend for float support exponents + return isdigit(C); // integer support +} + +bool RootS

[clang] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-02-09 Thread Chris B via cfe-commits
@@ -0,0 +1,151 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +namespace llvm { +namespace hlsl { +namespace root_signature { + +// Lexer Definitions + +static bool IsPreprocessorNumberChar(char C) { + // TODO: extend for float support with or without hexadecimal/exponent

[clang] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-02-09 Thread Chris B via cfe-commits
@@ -1017,4 +1017,15 @@ Error<"'#pragma unsafe_buffer_usage' was not ended">; def err_pp_pragma_unsafe_buffer_usage_syntax : Error<"expected 'begin' or 'end'">; + +// HLSL Root Signature Lexing Errors +let CategoryName = "Root Signature Lexical Issue" in { + def err_hlsl_inval

[clang] [HLSL] Desugar type when converting from a ConstantArrayType to an ArrayParameterType (PR #126561)

2025-02-10 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/126561 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-05 Thread Chris B via cfe-commits
llvm-beanz wrote: note to self: https://hlsl.godbolt.org/z/1Tq59r89W https://github.com/llvm/llvm-project/pull/123141 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement HLSL Flat casting (excluding splat cases) (PR #118842)

2025-02-06 Thread Chris B via cfe-commits
llvm-beanz wrote: > I think I already did this > clang/test/SemaHLSL/Language/ElementwiseCast-errors.hlsl Perfect! Sorry for missing that. LGTM https://github.com/llvm/llvm-project/pull/118842 ___ cfe-commits mailing list cfe-commits@lists.llvm.org h

[clang] [HLSL] Implement HLSL Flat casting (excluding splat cases) (PR #118842)

2025-02-06 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. One small request: can you add a test that verifies we produce an error if you try to cast to or from a structure containing a bitfield? https://github.com/llvm/llvm-project/pull/118842 ___ cfe

[clang] [HLSL] Implement HLSL Elementwise casting (excluding splat cases); Re-land #118842 (PR #126258)

2025-02-07 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/126258 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-10 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/123141 >From 8457635e366f791d03604384c232bc3d270ce0f8 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 15 Jan 2025 13:40:29 -0600 Subject: [PATCH 1/2] [HLSL] Implement HLSL intialization list support This P

[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-10 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/123141 >From 8457635e366f791d03604384c232bc3d270ce0f8 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 15 Jan 2025 13:40:29 -0600 Subject: [PATCH 1/3] [HLSL] Implement HLSL intialization list support This P

[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-10 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/123141 >From 8457635e366f791d03604384c232bc3d270ce0f8 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 15 Jan 2025 13:40:29 -0600 Subject: [PATCH 1/4] [HLSL] Implement HLSL intialization list support This P

[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-10 Thread Chris B via cfe-commits
@@ -0,0 +1,69 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -finclude-default-header -verify -Wdouble-promotion -Wconversion %s + +struct TwoFloats { + float X, Y; +}; + +struct TwoInts { + int Z, W; +}; + +struct Doggo { + int4 LegState; + int TailState; + f

[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

2025-02-10 Thread Chris B via cfe-commits
https://github.com/llvm-beanz updated https://github.com/llvm/llvm-project/pull/123141 >From a5d0d86b71ac7d7083295f255b42d991859a62f1 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 15 Jan 2025 13:40:29 -0600 Subject: [PATCH 1/5] [HLSL] Implement HLSL intialization list support This P

[clang] [HLSL] Appropriately set function attribute optnone (PR #125937)

2025-02-11 Thread Chris B via cfe-commits
@@ -345,6 +345,14 @@ void clang::CodeGen::CGHLSLRuntime::setHLSLEntryAttributes( WaveSizeAttr->getPreferred()); Fn->addFnAttr(WaveSizeKindStr, WaveSizeStr); } + // HLSL entry functions are materialized for module functions with + // HLSLShaderAttr attrib

[clang] [HLSL] Appropriately set function attribute optnone (PR #125937)

2025-02-11 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/125937 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Appropriately set function attribute optnone (PR #125937)

2025-02-11 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. One nit, otherwise LGTM. https://github.com/llvm/llvm-project/pull/125937 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Fix resource wrapper declaration (PR #125718)

2025-02-11 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: I have a couple concerns about this approach. I'm curious for @bogner's thoughts since he has approved the PR. 1) If/when we support separate compilation, the user-facing exported "resource" object will be the resource wrapper, not the handle, so that i

[clang] [HLSL] Change clang Driver Options to not set CXXOperatorNames (PR #126758)

2025-02-11 Thread Chris B via cfe-commits
llvm-beanz wrote: This seems like the wrong place to put this test. We don't need actual codegen here, we just need to make sure it parses. I'd put this under SemaHLSL and instead use a run line like: ```hlsl // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-l

[clang] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-02-11 Thread Chris B via cfe-commits
@@ -1017,4 +1017,15 @@ Error<"'#pragma unsafe_buffer_usage' was not ended">; def err_pp_pragma_unsafe_buffer_usage_syntax : Error<"expected 'begin' or 'end'">; + +// HLSL Root Signature Lexing Errors +let CategoryName = "Root Signature Lexical Issue" in { + def err_hlsl_expec

[clang] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-02-11 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: In general I think this is very much moving in the right direction. I have two high level areas of feedback (see my more specific comments inline). In general, Lexer's don't often have the context to provide actionable error messages. As a result it is

[clang] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-02-11 Thread Chris B via cfe-commits
@@ -0,0 +1,194 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +namespace clang { +namespace hlsl { + +// Lexer Definitions + +static bool IsNumberChar(char C) { + // TODO(#126565): extend for float support exponents + return isdigit(C); // integer support +} + +bool RootS

[clang] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-02-11 Thread Chris B via cfe-commits
@@ -0,0 +1,194 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +namespace clang { +namespace hlsl { + +// Lexer Definitions + +static bool IsNumberChar(char C) { + // TODO(#126565): extend for float support exponents + return isdigit(C); // integer support +} + +bool RootS

[clang] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-02-11 Thread Chris B via cfe-commits
@@ -0,0 +1,194 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +namespace clang { +namespace hlsl { + +// Lexer Definitions + +static bool IsNumberChar(char C) { + // TODO(#126565): extend for float support exponents + return isdigit(C); // integer support +} + +bool RootS

[clang] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-02-11 Thread Chris B via cfe-commits
@@ -0,0 +1,171 @@ +#include "clang/Parse/ParseHLSLRootSignature.h" + +namespace clang { +namespace hlsl { + +// Lexer Definitions + +static bool IsNumberChar(char C) { + // TODO(#120472): extend for float support exponents + return isdigit(C); // integer support +} + +bool RootS

[clang] [HLSL][RootSignature] Implement Lexing of DescriptorTables (PR #122981)

2025-02-11 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/122981 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clangd] Update clangDaemonTweaks to set symbol visibility macros (PR #112304)

2024-12-11 Thread Chris B via cfe-commits
@@ -114,7 +114,7 @@ macro(add_clang_library name) if(TARGET "obj.${name}") target_compile_definitions("obj.${name}" PUBLIC CLANG_BUILD_STATIC) endif() - elseif(NOT ARG_SHARED AND NOT ARG_STATIC) + elseif(NOT ARG_SHARED AND NOT ARG_STATIC AND NOT ARG_CLANG_IMPORT

[clang] [clang-tools-extra] [clangd] Update clangDaemonTweaks to set symbol visibility macros (PR #112304)

2024-12-11 Thread Chris B via cfe-commits
llvm-beanz wrote: What is the case where an object library wouldn't need to act as `CLANG_IMPORT`? It seems to me like the object library needs to be built assuming that it is importing clang symbols unless it is one of the core clang components. https://github.com/llvm/llvm-project/pull/1123

[clang] [llvm] [HLSL] Implement SV_GroupThreadId semantic (PR #117781)

2024-12-10 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/117781 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Move `_init_resource_bindings` to entry point functions (PR #119311)

2024-12-10 Thread Chris B via cfe-commits
llvm-beanz wrote: Is this the right solution, or should we be doing something to force the constructor function to be generated. I'm a little worried that we have one path for initializing some types of globals and a different approach for other globals. https://github.com/llvm/llvm-project/p

[clang] [llvm] [HLSL][SPIRV][DXIL] Implement `WaveActiveSum` intrinsic (PR #118580)

2024-12-10 Thread Chris B via cfe-commits
@@ -9272,6 +9272,8 @@ def err_typecheck_expect_scalar_or_vector : Error< "a vector of such type is required">; def err_typecheck_expect_any_scalar_or_vector : Error< "invalid operand of type %0 where a scalar or vector is required">; +def err_typecheck_expect_scalar_or_vect

[clang] [NFC] Cleanup comments in HLSLExternalSemaSource.cpp (PR #119444)

2024-12-10 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/119444 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] Updating Debug Info generation for 'this' (PR #119445)

2024-12-12 Thread Chris B via cfe-commits
llvm-beanz wrote: > any chance you could A/B test this on a bootstrap of clang, for instance? To > help validate that this really is NFC/dead code? I did a little more archeology, and I'm actually struggling to find any point in the history where this change was required. The difference betwee

[clang] [HLSL] Move `_init_resource_bindings` to entry point functions (PR #119311)

2024-12-12 Thread Chris B via cfe-commits
llvm-beanz wrote: > You are correct @llvm-beanz, this change is not needed at all. Sorry for > wasting your time! Even a broken clock is right twice a day... me being the broken clock here 😄 It's never a waste to put something up to review if it helps us get to the right solution. https://gi

[clang] [llvm] [DirectX][SPIRV] Consistent names for HLSL resource intrinsics (PR #120466)

2024-12-18 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. https://github.com/llvm/llvm-project/pull/120466 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [DirectX][SPIRV] Consistent names for HLSL resource intrinsics (PR #120466)

2024-12-18 Thread Chris B via cfe-commits
@@ -208,37 +208,44 @@ Examples: .. code-block:: llvm - ; RWBuffer Buf : register(u5, space3) - %buf = call target("dx.TypedBuffer", <4 x float>, 1, 0, 0) - @llvm.dx.handle.fromBinding.tdx.TypedBuffer_f32_1_0( - i32 3, i32 5, i32 1, i32 0, i

[clang] [Clang] Add float type support to __builtin_reduce_add and __builtin_reduce_multipy (PR #120367)

2024-12-18 Thread Chris B via cfe-commits
@@ -1754,6 +1755,17 @@ static bool interp__builtin_vector_reduce(InterpState &S, CodePtr OpPC, PrimType ElemT = *S.getContext().classify(ElemType); unsigned NumElems = Arg.getNumElems(); + if (ElemType->isRealFloatingType()) { +if (ID != Builtin::BI__builtin_reduce_a

[clang] [Clang] Add float type support to __builtin_reduce_add and __builtin_reduce_multipy (PR #120367)

2024-12-18 Thread Chris B via cfe-commits
@@ -12338,7 +12338,8 @@ def err_builtin_invalid_arg_type: Error < "a vector of integers|" "an unsigned integer|" "an 'int'|" - "a vector of floating points}1 (was %2)">; + "a vector of floating points|" + "a vector of integers or floating points}1 (was %2)">; -

[clang] [HLSL] Make fast math the default for HLSL (PR #119820)

2024-12-18 Thread Chris B via cfe-commits
llvm-beanz wrote: With how `RUN` lines tend to get copied from test to test, I think it is probably best to limit how many tests explicitly disable fast math otherwise they're likely to proliferate across future tests. https://github.com/llvm/llvm-project/pull/119820 __

[clang] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2024-12-17 Thread Chris B via cfe-commits
@@ -3139,136 +3151,269 @@ Register SPIRVInstructionSelector::buildPointerToResource( return AcReg; } -bool SPIRVInstructionSelector::selectFirstBitHigh16(Register ResVReg, -const SPIRVType *ResType, -

[clang] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2024-12-17 Thread Chris B via cfe-commits
@@ -3139,136 +3151,269 @@ Register SPIRVInstructionSelector::buildPointerToResource( return AcReg; } -bool SPIRVInstructionSelector::selectFirstBitHigh16(Register ResVReg, -const SPIRVType *ResType, -

[clang] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2024-12-17 Thread Chris B via cfe-commits
@@ -3139,136 +3151,269 @@ Register SPIRVInstructionSelector::buildPointerToResource( return AcReg; } -bool SPIRVInstructionSelector::selectFirstBitHigh16(Register ResVReg, -const SPIRVType *ResType, -

[clang] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2024-12-17 Thread Chris B via cfe-commits
@@ -3139,136 +3151,269 @@ Register SPIRVInstructionSelector::buildPointerToResource( return AcReg; } -bool SPIRVInstructionSelector::selectFirstBitHigh16(Register ResVReg, -const SPIRVType *ResType, -

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-12-17 Thread Chris B via cfe-commits
@@ -1229,8 +1248,15 @@ FunctionPass *llvm::createSPIRVStructurizerPass() { PreservedAnalyses SPIRVStructurizerWrapper::run(Function &F, FunctionAnalysisManager &AF) { - FunctionPass *StructurizerPass = createSPIRVStructurizerPas

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-12-17 Thread Chris B via cfe-commits
@@ -0,0 +1,43 @@ +// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-compute -ast-dump %s | FileCheck %s + +// CHECK: FunctionDecl 0x{{[0-9A-Fa-f]+}} <{{.*}}> {{.*}} used branch 'int (int)' +// CHECK: AttributedStmt 0x{{[0-9A-Fa-f]+}} < +// CHECK-NEXT: -HLSLControlFlowHintAttr 0x

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-12-17 Thread Chris B via cfe-commits
@@ -0,0 +1,48 @@ +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple dxil-pc-shadermodel6.3-library %s -fnative-half-type -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple spirv-vulkan-library %s -fnative-half-type -emit-llvm -

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-12-17 Thread Chris B via cfe-commits
https://github.com/llvm-beanz requested changes to this pull request. Mostly minor nits, but the stuff in `SPIRVStructurizerWrapper::run` has to change before we land this. https://github.com/llvm/llvm-project/pull/116331 ___ cfe-commits mailing list

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-12-17 Thread Chris B via cfe-commits
@@ -2776,19 +2788,23 @@ bool SPIRVInstructionSelector::selectIntrinsic(Register ResVReg, } return MIB.constrainAllUses(TII, TRI, RBI); } - case Intrinsic::spv_loop_merge: - case Intrinsic::spv_selection_merge: { -const auto Opcode = IID == Intrinsic::spv_select

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-12-17 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/116331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-12-17 Thread Chris B via cfe-commits
@@ -295,6 +296,39 @@ static MDTuple *emitTopLevelLibraryNode(Module &M, MDNode *RMD, return constructEntryMetadata(nullptr, nullptr, RMD, Properties, Ctx); } +// TODO: We might need to refactor this to be more generic, +// in case we need more metadata to be replaced. +stat

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-12-17 Thread Chris B via cfe-commits
@@ -2081,7 +2081,26 @@ void CodeGenFunction::EmitBranchOnBoolExpr( Weights = createProfileWeights(TrueCount, CurrentCount - TrueCount); } - Builder.CreateCondBr(CondV, TrueBlock, FalseBlock, Weights, Unpredictable); + auto *BrInst = Builder.CreateCondBr(CondV, TrueBloc

[clang] [llvm] [HLSL][SPIRV][DXIL] Implement `WaveActiveSum` intrinsic (PR #118580)

2024-12-17 Thread Chris B via cfe-commits
@@ -9272,6 +9272,8 @@ def err_typecheck_expect_scalar_or_vector : Error< "a vector of such type is required">; def err_typecheck_expect_any_scalar_or_vector : Error< "invalid operand of type %0 where a scalar or vector is required">; +def err_typecheck_expect_scalar_or_vect

[clang] [llvm] [HLSL] Implement elementwise firstbitlow builtin (PR #116858)

2024-12-17 Thread Chris B via cfe-commits
@@ -17,12 +17,10 @@ double test_int_builtin(double p0) { double2 test_int_builtin_2(double2 p0) { return __builtin_hlsl_elementwise_firstbithigh(p0); - // expected-error@-1 {{1st argument must be a vector of integers - // (was 'double2' (aka 'vector'))}} + // expected-err

[clang] [HLSL] Make fast math the default for HLSL (PR #119820)

2024-12-19 Thread Chris B via cfe-commits
llvm-beanz wrote: Quick sanity check question for @bogner: In DXC we apply the `fast` flag, which in LLVM 3.7 implies: `nnan ninf nsz arcp` and includes the modern interpretation of `reassoc` With this change we are applying: `reassoc nnan ninf nsz arcp afn` (no `fast` because its meaning is

[clang] [HLSL] Codegen for `cbuffer` declarations without embedded arrays or structs (PR #119755)

2024-12-20 Thread Chris B via cfe-commits
https://github.com/llvm-beanz requested changes to this pull request. https://github.com/llvm/llvm-project/pull/119755 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [HLSL] Codegen for `cbuffer` declarations without embedded arrays or structs (PR #119755)

2024-12-20 Thread Chris B via cfe-commits
@@ -54,78 +54,108 @@ void addDxilValVersion(StringRef ValVersionStr, llvm::Module &M) { auto *DXILValMD = M.getOrInsertNamedMetadata(DXILValKey); DXILValMD->addOperand(Val); } + void addDisableOptimizations(llvm::Module &M) { StringRef Key = "dx.disable_optimizations";

[clang] [HLSL] Codegen for `cbuffer` declarations without embedded arrays or structs (PR #119755)

2024-12-20 Thread Chris B via cfe-commits
@@ -54,78 +54,108 @@ void addDxilValVersion(StringRef ValVersionStr, llvm::Module &M) { auto *DXILValMD = M.getOrInsertNamedMetadata(DXILValKey); DXILValMD->addOperand(Val); } + void addDisableOptimizations(llvm::Module &M) { StringRef Key = "dx.disable_optimizations";

[clang] [HLSL] Codegen for `cbuffer` declarations without embedded arrays or structs (PR #119755)

2024-12-20 Thread Chris B via cfe-commits
@@ -54,78 +54,108 @@ void addDxilValVersion(StringRef ValVersionStr, llvm::Module &M) { auto *DXILValMD = M.getOrInsertNamedMetadata(DXILValKey); DXILValMD->addOperand(Val); } + void addDisableOptimizations(llvm::Module &M) { StringRef Key = "dx.disable_optimizations";

[clang] [HLSL] Codegen for `cbuffer` declarations without embedded arrays or structs (PR #119755)

2024-12-20 Thread Chris B via cfe-commits
@@ -164,18 +164,18 @@ Decl *SemaHLSL::ActOnStartBuffer(Scope *BufferScope, bool CBuffer, return Result; } -// Calculate the size of a legacy cbuffer type based on +// Calculate the size of a legacy cbuffer type in bytes based on // https://learn.microsoft.com/en-us/window

[clang] [HLSL] Codegen for `cbuffer` declarations without embedded arrays or structs (PR #119755)

2024-12-20 Thread Chris B via cfe-commits
@@ -890,6 +890,10 @@ CodeGenModule::EmitCXXGlobalInitFunc() { ModuleInits.push_back(Fn); } + if (getLangOpts().HLSL && getHLSLRuntime().needsResourceBindingInitFn()) { +CXXGlobalInits.push_back(getHLSLRuntime().createResourceBindingInitFn()); + } --

[clang] [HLSL] Get the index for resource bindings from the slot (PR #117303)

2024-11-22 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. This change looks right for DXIL (and I'll approve in that context), but @s-perron's comment about SPIR-V is something we should address before merging. https://github.com/llvm/llvm-project/pull/117303 ___

[clang] [llvm] [DirectX] Calculate resource binding offsets using the lower bound (PR #117303)

2024-11-22 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. This approach makes sense to me. https://github.com/llvm/llvm-project/pull/117303 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-comm

[clang] [HLSL] Get the index for resource bindings from the slot (PR #117303)

2024-11-22 Thread Chris B via cfe-commits
@@ -588,7 +588,7 @@ llvm::Function *CGHLSLRuntime::createResourceBindingInitFn() { auto *Slot = llvm::ConstantInt::get(CGM.IntTy, RBA->getSlotNumber()); // FIXME: resource arrays are not yet implemented auto *Range = llvm::ConstantInt::get(CGM.IntTy, 1); -

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-11-22 Thread Chris B via cfe-commits
@@ -300,6 +301,36 @@ static MDTuple *emitTopLevelLibraryNode(Module &M, MDNode *RMD, return constructEntryMetadata(nullptr, nullptr, RMD, Properties, Ctx); } +// TODO: We might need to refactor this to be more generic, +// in case we need more metadata to be replaced. +stat

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-11-22 Thread Chris B via cfe-commits
@@ -2694,19 +2694,41 @@ bool SPIRVInstructionSelector::selectIntrinsic(Register ResVReg, } return MIB.constrainAllUses(TII, TRI, RBI); } - case Intrinsic::spv_loop_merge: - case Intrinsic::spv_selection_merge: { -const auto Opcode = IID == Intrinsic::spv_select

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-11-22 Thread Chris B via cfe-commits
@@ -1206,6 +1202,20 @@ class SPIRVStructurizer : public FunctionPass { AU.addPreserved(); FunctionPass::getAnalysisUsage(AU); } + + void createOpSelectMerge(IRBuilder<> *Builder, BlockAddress *MergeAddress) { +Instruction *BBTerminatorInst = Builder->GetInsertBlo

[clang] [HLSL] Implement SV_GroupID semantic (PR #115911)

2024-11-22 Thread Chris B via cfe-commits
@@ -784,6 +785,17 @@ void SemaHLSL::handleSV_DispatchThreadIDAttr(Decl *D, const ParsedAttr &AL) { HLSLSV_DispatchThreadIDAttr(getASTContext(), AL)); } +void SemaHLSL::handleSV_GroupIDAttr(Decl *D, const ParsedAttr &AL) { + auto *VD = cast(D); + if (!isLega

[clang] [HLSL] Implement SV_GroupID semantic (PR #115911)

2024-11-22 Thread Chris B via cfe-commits
@@ -784,6 +785,17 @@ void SemaHLSL::handleSV_DispatchThreadIDAttr(Decl *D, const ParsedAttr &AL) { HLSLSV_DispatchThreadIDAttr(getASTContext(), AL)); } +void SemaHLSL::handleSV_GroupIDAttr(Decl *D, const ParsedAttr &AL) { + auto *VD = cast(D); + if (!isLega

[clang] [llvm] [HLSL] Add implicit resource element type concepts to AST (PR #116413)

2024-11-22 Thread Chris B via cfe-commits
https://github.com/llvm-beanz approved this pull request. This looks great! I know there was a lot of churn on this, but it came out really great. Thank you! https://github.com/llvm/llvm-project/pull/116413 ___ cfe-commits mailing list cfe-commits@li

[clang] [HLSL] get inout/out ABI for array parameters working (PR #111047)

2024-12-03 Thread Chris B via cfe-commits
@@ -5322,6 +5324,11 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, IRCallArgs[FirstIRArg] = Val; break; } + } else if (I->getType()->isArrayParameterType()) { +// use the tmp created by the HLSLOutArgExpr +/

[clang-tools-extra] [clangd] Do not show `aParam` parameter hint for argument spelled `param` (PR #119162)

2024-12-22 Thread Chris B via cfe-commits
https://github.com/llvm-beanz commented: I think this gets really complicated really quickly. The `a` prefix for arguments seems like a coding style derived from Hungarian Notation, and I guess I could see an argument for having an option to disregard variable prefixes when matching the hints,

[clang] [clang-tools-extra] [clangd] Make clangd run `format::cleanupAroundReplacements()` for all code actions just as clang-tidy does (PR #118569)

2024-12-22 Thread Chris B via cfe-commits
@@ -761,7 +762,37 @@ void StoreDiags::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, return false; if (!isInsideMainFile(FixIt.RemoveRange.getBegin(), SM)) return false; - Edits.push_back(toTextEdit(FixIt, SM, *LangOpts)); + + auto R = too

[clang] [clang-tools-extra] [clangd] Make clangd run `format::cleanupAroundReplacements()` for all code actions just as clang-tidy does (PR #118569)

2024-12-22 Thread Chris B via cfe-commits
@@ -761,7 +762,37 @@ void StoreDiags::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, return false; if (!isInsideMainFile(FixIt.RemoveRange.getBegin(), SM)) return false; - Edits.push_back(toTextEdit(FixIt, SM, *LangOpts)); + + auto R = too

[clang] [clang-tools-extra] [clangd] Make clangd run `format::cleanupAroundReplacements()` for all code actions just as clang-tidy does (PR #118569)

2024-12-22 Thread Chris B via cfe-commits
https://github.com/llvm-beanz edited https://github.com/llvm/llvm-project/pull/118569 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clangd] Make clangd run `format::cleanupAroundReplacements()` for all code actions just as clang-tidy does (PR #118569)

2024-12-22 Thread Chris B via cfe-commits
@@ -761,7 +762,37 @@ void StoreDiags::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, return false; if (!isInsideMainFile(FixIt.RemoveRange.getBegin(), SM)) return false; - Edits.push_back(toTextEdit(FixIt, SM, *LangOpts)); + + auto R = too

<    3   4   5   6   7   8   9   10   >