Skip to content

[DirectX] add Function name to DiagnosticInfoUnsupported Msg in DXILOpLowering #136234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions clang/test/CodeGenDirectX/unsupported_intrinsic.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// REQUIRES: directx-registered-target
// RUN: not %clang_dxc -T lib_6_3 %s 2>&1 | FileCheck %s

// CHECK: error: Unsupported intrinsic llvm.vector.reduce.and.v4i32 for DXIL lowering

export int vecReduceAndTest(int4 vec) {
return __builtin_reduce_and(vec);
}
8 changes: 4 additions & 4 deletions llvm/lib/Target/DirectX/DXILOpLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "DXILOpLowering.h"
#include "DXILConstants.h"
#include "DXILIntrinsicExpansion.h"
#include "DXILOpBuilder.h"
#include "DXILShaderFlags.h"
#include "DirectX.h"
Expand All @@ -27,6 +26,7 @@
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormatVariadic.h"

#define DEBUG_TYPE "dxil-op-lower"

Expand Down Expand Up @@ -756,9 +756,9 @@ class OpLowerer {
case Intrinsic::not_intrinsic:
continue;
default: {
DiagnosticInfoUnsupported Diag(
F, "Unsupported intrinsic for DXIL lowering");
M.getContext().diagnose(Diag);
SmallString<128> Msg =
formatv("Unsupported intrinsic {0} for DXIL lowering", F.getName());
M.getContext().emitError(Msg);
HasErrors |= true;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/DirectX/unsupported_intrinsic.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s

; CHECK: error: <unknown>:0:0: in function llvm.vector.reduce.and.v4i32 i32 (<4 x i32>): Unsupported intrinsic for DXIL lowering
; CHECK: error: Unsupported intrinsic llvm.vector.reduce.and.v4i32 for DXIL lowering
define i32 @fn_and(<4 x i32> %0) local_unnamed_addr #0 {
%2 = tail call i32 @llvm.vector.reduce.and.v4i32(<4 x i32> %0)
ret i32 %2
Expand Down
Loading