https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/230765
Instead of creating a call and then recreating it with a convergencectrl operand bundle, add the bundle when the call is created. Recreating the call left EmitCall's callOrInvoke pointing at the erased call, and lost any metadata already attached to it, such as !alloc_token and !callee_type. For calls from EmitCall, decide whether a token is needed from the call site attributes derived from the callee declaration, rather than from the IR. Co-authored-by: Claude Opus 5.5 <[email protected]> >From 9c2021ef94cf1d044a1b44aafe06cd39c7585ecd Mon Sep 17 00:00:00 2001 From: Matt Arsenault <[email protected]> Date: Fri, 9 Oct 2026 12:46:45 -0700 Subject: [PATCH] clang: Add convergence control bundles when creating calls Instead of creating a call and then recreating it with a convergencectrl operand bundle, add the bundle when the call is created. Recreating the call left EmitCall's callOrInvoke pointing at the erased call, and lost any metadata already attached to it, such as !alloc_token and !callee_type. For calls from EmitCall, decide whether a token is needed from the call site attributes derived from the callee declaration, rather than from the IR. Co-authored-by: Claude Opus 5.5 <[email protected]> --- clang/lib/CodeGen/CGCall.cpp | 47 ++++++++++--------- clang/lib/CodeGen/CGDeclCXX.cpp | 11 +++-- clang/lib/CodeGen/CGStmt.cpp | 16 +++---- clang/lib/CodeGen/CodeGenFunction.h | 9 ++-- .../convergence-control-call-metadata.c | 29 ++++++++++++ clang/test/CodeGenHLSL/convergence/for.hlsl | 2 +- clang/test/CodeGenHLSL/convergence/while.hlsl | 4 +- .../resources/ByteAddressBuffers-methods.hlsl | 6 +-- .../StructuredBuffers-methods-lib.hlsl | 2 +- .../StructuredBuffers-methods-ps.hlsl | 2 +- .../resources/TypedBuffers-methods.hlsl | 2 +- .../CodeGenHLSL/vk-features/SpirvType.hlsl | 8 ++-- 12 files changed, 84 insertions(+), 54 deletions(-) create mode 100644 clang/test/CodeGen/convergence-control-call-metadata.c diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 1f4fd55060d39..8014b242e41fd 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -5448,12 +5448,13 @@ CodeGenFunction::getBundlesForFunclet(llvm::Value *Callee) { llvm::CallInst *CodeGenFunction::EmitRuntimeCall(llvm::FunctionCallee callee, ArrayRef<llvm::Value *> args, const llvm::Twine &name) { - llvm::CallInst *call = Builder.CreateCall( - callee, args, getBundlesForFunclet(callee.getCallee()), name); + SmallVector<llvm::OperandBundleDef> BundleList = + getBundlesForFunclet(callee.getCallee()); + if (auto *F = dyn_cast<llvm::Function>(callee.getCallee()); + F && F->isConvergent()) + addConvergenceControlBundle(BundleList); + llvm::CallInst *call = Builder.CreateCall(callee, args, BundleList, name); call->setCallingConv(getRuntimeCC()); - - if (CGM.shouldEmitConvergenceTokens() && call->isConvergent()) - return cast<llvm::CallInst>(addConvergenceControlToken(call)); return call; } @@ -5474,11 +5475,10 @@ llvm::CallInst *CodeGenFunction::EmitIntrinsicCall(llvm::Intrinsic::ID ID, const llvm::Twine &Name) { llvm::Function *F = llvm::Intrinsic::getOrInsertDeclaration(&CGM.getModule(), ID, Types); - llvm::CallInst *Call = - Builder.CreateCall(F, Args, getBundlesForFunclet(F), Name); - if (CGM.shouldEmitConvergenceTokens() && Call->isConvergent()) - return cast<llvm::CallInst>(addConvergenceControlToken(Call)); - return Call; + SmallVector<llvm::OperandBundleDef> BundleList = getBundlesForFunclet(F); + if (F->isConvergent()) + addConvergenceControlBundle(BundleList); + return Builder.CreateCall(F, Args, BundleList, Name); } llvm::CallInst *CodeGenFunction::EmitIntrinsicCall(llvm::Intrinsic::ID ID, @@ -5491,11 +5491,10 @@ llvm::CallInst *CodeGenFunction::EmitIntrinsicCall(llvm::Intrinsic::ID ID, ArgTys.push_back(Arg->getType()); llvm::Function *F = llvm::Intrinsic::getOrInsertDeclaration( &CGM.getModule(), ID, RetTy, ArgTys); - llvm::CallInst *Call = - Builder.CreateCall(F, Args, getBundlesForFunclet(F), Name); - if (CGM.shouldEmitConvergenceTokens() && Call->isConvergent()) - return cast<llvm::CallInst>(addConvergenceControlToken(Call)); - return Call; + SmallVector<llvm::OperandBundleDef> BundleList = getBundlesForFunclet(F); + if (F->isConvergent()) + addConvergenceControlBundle(BundleList); + return Builder.CreateCall(F, Args, BundleList, Name); } /// Emits a call or invoke to the given noreturn runtime function. @@ -6311,11 +6310,6 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, Attrs = Attrs.addFnAttribute(getLLVMContext(), llvm::Attribute::AlwaysInline); - // Remove call-site convergent attribute if requested. - if (InNoConvergentAttributedStmt) - Attrs = - Attrs.removeFnAttribute(getLLVMContext(), llvm::Attribute::Convergent); - // Apply some call-site-specific attributes. // TODO: work this into building the attribute set. @@ -6388,6 +6382,16 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, AllocAlignAttrEmitter AllocAlignAttrEmitter(*this, TargetDecl, CallArgs); Attrs = AllocAlignAttrEmitter.TryEmitAsCallSiteAttribute(Attrs); + if (Attrs.hasFnAttr(llvm::Attribute::Convergent)) + addConvergenceControlBundle(BundleList); + + // Remove call-site convergent attribute if requested. This does not stop a + // call to a convergent callee from being convergent, so the convergence + // control token above is still needed. + if (InNoConvergentAttributedStmt) + Attrs = + Attrs.removeFnAttribute(getLLVMContext(), llvm::Attribute::Convergent); + // Emit the actual call/invoke instruction. llvm::CallBase *CI; if (!InvokeDest) { @@ -6497,9 +6501,6 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, if (!CI->getType()->isVoidTy()) CI->setName("call"); - if (CGM.shouldEmitConvergenceTokens() && CI->isConvergent()) - CI = addConvergenceControlToken(CI); - // Update largest vector width from the return type. LargestVectorWidth = std::max(LargestVectorWidth, getMaxVectorWidth(CI->getType())); diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp index a54809c48037e..be6c7570142c4 100644 --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/lib/CodeGen/CGDeclCXX.cpp @@ -1155,12 +1155,16 @@ void CodeGenFunction::GenerateCXXGlobalCleanUpFunc( llvm::Constant *Arg; std::tie(CalleeTy, Callee, Arg) = DtorsOrStermFinalizers[e - i - 1]; + SmallVector<llvm::OperandBundleDef> BundleList; + if (auto *F = dyn_cast<llvm::Function>(Callee); F && F->isConvergent()) + addConvergenceControlBundle(BundleList); + llvm::CallBase *CI = nullptr; if (Arg == nullptr) { assert( CGM.getCXXABI().useSinitAndSterm() && "Arg could not be nullptr unless using sinit and sterm functions."); - CI = Builder.CreateCall(CalleeTy, Callee); + CI = Builder.CreateCall(CalleeTy, Callee, {}, BundleList); } else { // If the object lives in a different address space, the `this` pointer // address space won't match the dtor `this` param. An addrspacecast is @@ -1175,15 +1179,12 @@ void CodeGenFunction::GenerateCXXGlobalCleanUpFunc( llvm::PointerType::get(getLLVMContext(), ExpectedAddrSpace); Arg = llvm::ConstantExpr::getAddrSpaceCast(Arg, PTy); } - CI = Builder.CreateCall(CalleeTy, Callee, Arg); + CI = Builder.CreateCall(CalleeTy, Callee, Arg, BundleList); } // Make sure the call and the callee agree on calling convention. if (llvm::Function *F = dyn_cast<llvm::Function>(Callee)) CI->setCallingConv(F->getCallingConv()); - - if (CGM.shouldEmitConvergenceTokens() && CI->isConvergent()) - CI = addConvergenceControlToken(CI); } } diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 05b3693138b0a..5266c1d83b3d0 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -3519,18 +3519,14 @@ static llvm::ConvergenceControlInst *getConvergenceToken(llvm::BasicBlock *BB) { return nullptr; } -llvm::CallBase * -CodeGenFunction::addConvergenceControlToken(llvm::CallBase *Input) { +void CodeGenFunction::addConvergenceControlBundle( + SmallVectorImpl<llvm::OperandBundleDef> &Bundles) { + if (!CGM.shouldEmitConvergenceTokens()) + return; + llvm::ConvergenceControlInst *ParentToken = ConvergenceTokenStack.back(); assert(ParentToken); - - llvm::Value *bundleArgs[] = {ParentToken}; - llvm::OperandBundleDef OB("convergencectrl", bundleArgs); - auto *Output = llvm::CallBase::addOperandBundle( - Input, llvm::LLVMContext::OB_convergencectrl, OB, Input->getIterator()); - Input->replaceAllUsesWith(Output); - Input->eraseFromParent(); - return Output; + Bundles.emplace_back("convergencectrl", ParentToken); } llvm::ConvergenceControlInst * diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 00294ad547d5e..2f37720b6a6a9 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -5562,9 +5562,12 @@ class CodeGenFunction : public CodeGenTypeCache { llvm::ConvergenceControlInst *emitConvergenceLoopToken(llvm::BasicBlock *BB); private: - // Adds a convergence_ctrl token with |ParentToken| as parent convergence - // instr to the call |Input|. - llvm::CallBase *addConvergenceControlToken(llvm::CallBase *Input); + // Adds a convergencectrl operand bundle using the current convergence token + // to |Bundles| for a convergent call, if convergence tokens are in use. + // This must be done before the call is created, since operand bundles + // cannot be added to an existing call. + void + addConvergenceControlBundle(SmallVectorImpl<llvm::OperandBundleDef> &Bundles); // Find the convergence_entry instruction |F|, or emits ones if none exists. // Returns the convergence instruction. diff --git a/clang/test/CodeGen/convergence-control-call-metadata.c b/clang/test/CodeGen/convergence-control-call-metadata.c new file mode 100644 index 0000000000000..44fa5abbc6d50 --- /dev/null +++ b/clang/test/CodeGen/convergence-control-call-metadata.c @@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -triple spirv1.6-unknown-vulkan1.3-compute -fsanitize=alloc-token -emit-llvm -disable-llvm-passes %s -o - | FileCheck --check-prefix=ALLOC-TOKEN %s +// RUN: %clang_cc1 -triple spirv1.6-unknown-vulkan1.3-compute -fconvergent-functions -fexperimental-call-graph-section -emit-llvm -disable-llvm-passes %s -o - | FileCheck --check-prefix=CALL-GRAPH %s + +// Check that metadata attached to a convergent call is preserved when it +// gets a convergence control token. + +typedef __typeof(sizeof(int)) size_t; + +void *my_malloc(size_t size) __attribute__((malloc, alloc_size(1), convergent)); + +// ALLOC-TOKEN-LABEL: @test_malloc( +// ALLOC-TOKEN: [[TOKEN:%.*]] = call token @llvm.experimental.convergence.entry() +// ALLOC-TOKEN: call spir_func noalias ptr @my_malloc(i32 noundef 4){{.*}} [ "convergencectrl"(token [[TOKEN]]) ], !alloc_token [[META_INT:![0-9]+]] +int *test_malloc(void) { + return (int *)my_malloc(sizeof(int)); +} + +void (*fp)(int); + +// CALL-GRAPH-LABEL: @test_indirect( +// CALL-GRAPH: [[TOKEN:%.*]] = call token @llvm.experimental.convergence.entry() +// CALL-GRAPH: call spir_func void %{{.*}}(i32 noundef %{{.*}}){{.*}} [ "convergencectrl"(token [[TOKEN]]) ], !callee_type [[CALLEE_TYPE:![0-9]+]] +void test_indirect(int x) { + fp(x); +} + +// ALLOC-TOKEN: [[META_INT]] = !{!"int", i1 false} +// CALL-GRAPH-DAG: [[CALLEE_TYPE]] = !{[[TYPE_ID:![0-9]+]]} +// CALL-GRAPH-DAG: [[TYPE_ID]] = !{!"_ZTSFviE"} diff --git a/clang/test/CodeGenHLSL/convergence/for.hlsl b/clang/test/CodeGenHLSL/convergence/for.hlsl index c4c1770c26730..4aed0ae6921d9 100644 --- a/clang/test/CodeGenHLSL/convergence/for.hlsl +++ b/clang/test/CodeGenHLSL/convergence/for.hlsl @@ -122,7 +122,7 @@ void test7() { // CHECK: for.cond: // CHECK: [[T1:%[0-9]+]] = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token [[T0]]) ] // CHECK: call{{.*}} noundef i1 @_Z4condv() [[A3]] [ "convergencectrl"(token [[T1]]) ] -// CHECK: for.cond3: +// CHECK: for.cond2: // CHECK: [[T2:%[0-9]+]] = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token [[T1]]) ] // CHECK: call{{.*}} void @_Z3foov() [[A3]] [ "convergencectrl"(token [[T2]]) ] diff --git a/clang/test/CodeGenHLSL/convergence/while.hlsl b/clang/test/CodeGenHLSL/convergence/while.hlsl index 4e8cdcdaa7563..c29674dbb91ae 100644 --- a/clang/test/CodeGenHLSL/convergence/while.hlsl +++ b/clang/test/CodeGenHLSL/convergence/while.hlsl @@ -91,7 +91,7 @@ void test5() { // CHECK: while.cond: // CHECK: [[T1:%[0-9]+]] = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token [[T0]]) ] // CHECK: call{{.*}} noundef i1 @_Z4condv() [[A3]] [ "convergencectrl"(token [[T1]]) ] -// CHECK: while.cond2: +// CHECK: while.cond1: // CHECK: [[T2:%[0-9]+]] = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token [[T1]]) ] // CHECK: call{{.*}} noundef i1 @_Z4condv() [[A3]] [ "convergencectrl"(token [[T2]]) ] // CHECK: if.then: @@ -116,7 +116,7 @@ void test6() { // CHECK: while.cond: // CHECK: [[T1:%[0-9]+]] = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token [[T0]]) ] // CHECK: call{{.*}} noundef i1 @_Z4condv() [[A3]] [ "convergencectrl"(token [[T1]]) ] -// CHECK: while.cond2: +// CHECK: while.cond1: // CHECK: [[T2:%[0-9]+]] = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token [[T1]]) ] // CHECK: call{{.*}} noundef i1 @_Z4condv() [[A3]] [ "convergencectrl"(token [[T2]]) ] // CHECK: if.then: diff --git a/clang/test/CodeGenHLSL/resources/ByteAddressBuffers-methods.hlsl b/clang/test/CodeGenHLSL/resources/ByteAddressBuffers-methods.hlsl index 93291a823e483..fc3e8fb6dc7f9 100644 --- a/clang/test/CodeGenHLSL/resources/ByteAddressBuffers-methods.hlsl +++ b/clang/test/CodeGenHLSL/resources/ByteAddressBuffers-methods.hlsl @@ -67,9 +67,9 @@ export float TestLoadWithStatus() { // CHECK: define {{.*}} float @TestLoadWithStatus()() // CHECK: %[[TOK:.*]] = call token @llvm.experimental.convergence.entry() // CHECK: call {{.*}} i32 @hlsl::ByteAddressBuffer::Load(unsigned int, unsigned int&) const(ptr {{.*}} @Buf, i32 noundef 0, ptr {{.*}} %tmp) {{.*}} [ "convergencectrl"(token %[[TOK]]) ] -// CHECK: call {{.*}} <4 x i32> @hlsl::RWByteAddressBuffer::Load4(unsigned int, unsigned int&) const(ptr {{.*}} @RWBuf, i32 noundef 4, ptr {{.*}} %tmp2) {{.*}} [ "convergencectrl"(token %[[TOK]]) ] -// CHECK: call {{.*}} float @float hlsl::ByteAddressBuffer::Load<float>(unsigned int, unsigned int&) const(ptr {{.*}} @Buf, i32 noundef 20, ptr {{.*}} %tmp5) {{.*}} [ "convergencectrl"(token %[[TOK]]) ] -// CHECK: call {{.*}} <4 x float> @float vector[4] hlsl::RWByteAddressBuffer::Load<float vector[4]>(unsigned int, unsigned int&) const(ptr {{.*}} @RWBuf, i32 noundef 24, ptr {{.*}} %tmp8) {{.*}} [ "convergencectrl"(token %[[TOK]]) ] +// CHECK: call {{.*}} <4 x i32> @hlsl::RWByteAddressBuffer::Load4(unsigned int, unsigned int&) const(ptr {{.*}} @RWBuf, i32 noundef 4, ptr {{.*}} %tmp1) {{.*}} [ "convergencectrl"(token %[[TOK]]) ] +// CHECK: call {{.*}} float @float hlsl::ByteAddressBuffer::Load<float>(unsigned int, unsigned int&) const(ptr {{.*}} @Buf, i32 noundef 20, ptr {{.*}} %tmp4) {{.*}} [ "convergencectrl"(token %[[TOK]]) ] +// CHECK: call {{.*}} <4 x float> @float vector[4] hlsl::RWByteAddressBuffer::Load<float vector[4]>(unsigned int, unsigned int&) const(ptr {{.*}} @RWBuf, i32 noundef 24, ptr {{.*}} %tmp7) {{.*}} [ "convergencectrl"(token %[[TOK]]) ] // CHECK: add // CHECK: ret float diff --git a/clang/test/CodeGenHLSL/resources/StructuredBuffers-methods-lib.hlsl b/clang/test/CodeGenHLSL/resources/StructuredBuffers-methods-lib.hlsl index fd452abbefb52..9f36e574e3fc7 100644 --- a/clang/test/CodeGenHLSL/resources/StructuredBuffers-methods-lib.hlsl +++ b/clang/test/CodeGenHLSL/resources/StructuredBuffers-methods-lib.hlsl @@ -120,7 +120,7 @@ export float TestLoadWithStatus() { // CHECK: define noundef nofpclass(nan inf) float @TestLoadWithStatus()() // CHECK: %[[TOK:.*]] = call token @llvm.experimental.convergence.entry() // CHECK: call {{.*}} float @hlsl::RWStructuredBuffer<float>::Load(unsigned int, unsigned int&) const(ptr {{.*}} @RWSB1, i32 noundef 1, ptr {{.*}} %tmp) {{.*}} [ "convergencectrl"(token %[[TOK]]) ] -// CHECK: call {{.*}} float @hlsl::StructuredBuffer<float>::Load(unsigned int, unsigned int&) const(ptr {{.*}} @SB1, i32 noundef 2, ptr {{.*}} %tmp2) {{.*}} [ "convergencectrl"(token %[[TOK]]) ] +// CHECK: call {{.*}} float @hlsl::StructuredBuffer<float>::Load(unsigned int, unsigned int&) const(ptr {{.*}} @SB1, i32 noundef 2, ptr {{.*}} %tmp1) {{.*}} [ "convergencectrl"(token %[[TOK]]) ] // CHECK: add // CHECK: ret float diff --git a/clang/test/CodeGenHLSL/resources/StructuredBuffers-methods-ps.hlsl b/clang/test/CodeGenHLSL/resources/StructuredBuffers-methods-ps.hlsl index b28752926edb4..5afb90066d666 100644 --- a/clang/test/CodeGenHLSL/resources/StructuredBuffers-methods-ps.hlsl +++ b/clang/test/CodeGenHLSL/resources/StructuredBuffers-methods-ps.hlsl @@ -78,7 +78,7 @@ export float TestLoadWithStatus() { // CHECK: define {{.*}} float @TestLoadWithStatus()() // CHECK: %[[TOK:.*]] = call token @llvm.experimental.convergence.entry() // CHECK: call {{.*}} float @hlsl::RasterizerOrderedStructuredBuffer<float>::Load(unsigned int, unsigned int&) const(ptr {{.*}} @ROSB1, i32 noundef 10, ptr {{.*}} %tmp) {{.*}} [ "convergencectrl"(token %[[TOK]]) ] -// CHECK: call {{.*}} <2 x i32> @hlsl::RasterizerOrderedStructuredBuffer<int vector[2]>::Load(unsigned int, unsigned int&) const(ptr {{.*}} @ROSB2, i32 noundef 20, ptr {{.*}} %tmp3) {{.*}} [ "convergencectrl"(token %[[TOK]]) ] +// CHECK: call {{.*}} <2 x i32> @hlsl::RasterizerOrderedStructuredBuffer<int vector[2]>::Load(unsigned int, unsigned int&) const(ptr {{.*}} @ROSB2, i32 noundef 20, ptr {{.*}} %tmp2) {{.*}} [ "convergencectrl"(token %[[TOK]]) ] // CHECK: ret // CHECK: define {{.*}} float @hlsl::RasterizerOrderedStructuredBuffer<float>::Load(unsigned int, unsigned int&) const(ptr {{.*}} %this, i32 noundef %Index, ptr {{.*}} %Status) diff --git a/clang/test/CodeGenHLSL/resources/TypedBuffers-methods.hlsl b/clang/test/CodeGenHLSL/resources/TypedBuffers-methods.hlsl index 99bf6b9bf725e..42950c399193d 100644 --- a/clang/test/CodeGenHLSL/resources/TypedBuffers-methods.hlsl +++ b/clang/test/CodeGenHLSL/resources/TypedBuffers-methods.hlsl @@ -50,7 +50,7 @@ export float TestLoadWithStatus() { // CHECK: define noundef nofpclass(nan inf) float @TestLoadWithStatus()() // CHECK: %[[TOK:.*]] = call token @llvm.experimental.convergence.entry() // CHECK: call {{.*}} float @hlsl::Buffer<float>::Load(unsigned int, unsigned int&) const(ptr {{.*}} @Buf, i32 noundef 1, ptr {{.*}} %tmp) {{.*}} [ "convergencectrl"(token %[[TOK]]) ] -// CHECK: call {{.*}} <4 x i32> @hlsl::RWBuffer<unsigned int vector[4]>::Load(unsigned int, unsigned int&) const(ptr {{.*}} @RWBuf, i32 noundef 2, ptr {{.*}} %tmp2) {{.*}} [ "convergencectrl"(token %[[TOK]]) ] +// CHECK: call {{.*}} <4 x i32> @hlsl::RWBuffer<unsigned int vector[4]>::Load(unsigned int, unsigned int&) const(ptr {{.*}} @RWBuf, i32 noundef 2, ptr {{.*}} %tmp1) {{.*}} [ "convergencectrl"(token %[[TOK]]) ] // CHECK: add // CHECK: ret float diff --git a/clang/test/CodeGenHLSL/vk-features/SpirvType.hlsl b/clang/test/CodeGenHLSL/vk-features/SpirvType.hlsl index 0cebac1e9d864..c733b08f23837 100644 --- a/clang/test/CodeGenHLSL/vk-features/SpirvType.hlsl +++ b/clang/test/CodeGenHLSL/vk-features/SpirvType.hlsl @@ -57,12 +57,12 @@ void main() { // CHECK: [[loaded:%[0-9]+]] = load target("spirv.Type", target("spirv.Image", float, 5, 2, 0, 0, 2, 0), target("spirv.IntegralConstant", i64, 4), 28, 0, 0), ptr [[buffers]], align 4 - // CHECK: %call1 = call spir_func target("spirv.Type", target("spirv.Image", float, 5, 2, 0, 0, 2, 0), target("spirv.IntegralConstant", i64, 4), 28, 0, 0) @_Z14getArrayBufferu17spirv_type_28_0_0U5_TypeN4hlsl8RWBufferIfEEU6_ConstLm4E(target("spirv.Type", target("spirv.Image", float, 5, 2, 0, 0, 2, 0), target("spirv.IntegralConstant", i64, 4), 28, 0, 0) [[loaded]]) - // CHECK: store target("spirv.Type", target("spirv.Image", float, 5, 2, 0, 0, 2, 0), target("spirv.IntegralConstant", i64, 4), 28, 0, 0) %call1, ptr [[buffers2]], align 4 + // CHECK: %call = call spir_func target("spirv.Type", target("spirv.Image", float, 5, 2, 0, 0, 2, 0), target("spirv.IntegralConstant", i64, 4), 28, 0, 0) @_Z14getArrayBufferu17spirv_type_28_0_0U5_TypeN4hlsl8RWBufferIfEEU6_ConstLm4E(target("spirv.Type", target("spirv.Image", float, 5, 2, 0, 0, 2, 0), target("spirv.IntegralConstant", i64, 4), 28, 0, 0) [[loaded]]) + // CHECK: store target("spirv.Type", target("spirv.Image", float, 5, 2, 0, 0, 2, 0), target("spirv.IntegralConstant", i64, 4), 28, 0, 0) %call, ptr [[buffers2]], align 4 ArrayBuffer<4> buffers2 = getArrayBuffer(buffers); // CHECK: [[loaded:%[0-9]+]] = load target("spirv.Type", target("spirv.Literal", 32), target("spirv.Literal", 0), 21, 4, 32), ptr [[word]], align 4 - // CHECK: %call2 = call spir_func target("spirv.Type", target("spirv.Literal", 32), target("spirv.Literal", 0), 21, 4, 32) @_Z6getIntu18spirv_type_21_4_32U4_LitLi32EU4_LitLi0E(target("spirv.Type", target("spirv.Literal", 32), target("spirv.Literal", 0), 21, 4, 32) [[loaded]]) - // CHECK: store target("spirv.Type", target("spirv.Literal", 32), target("spirv.Literal", 0), 21, 4, 32) %call2, ptr [[word2]], align 4 + // CHECK: %call1 = call spir_func target("spirv.Type", target("spirv.Literal", 32), target("spirv.Literal", 0), 21, 4, 32) @_Z6getIntu18spirv_type_21_4_32U4_LitLi32EU4_LitLi0E(target("spirv.Type", target("spirv.Literal", 32), target("spirv.Literal", 0), 21, 4, 32) [[loaded]]) + // CHECK: store target("spirv.Type", target("spirv.Literal", 32), target("spirv.Literal", 0), 21, 4, 32) %call1, ptr [[word2]], align 4 Int word2 = getInt(word); } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
