[CIR] Use -verify on clang/test/CIR/CodeGenHLSL/matrix-element-expr-load.hlsl - #182817
Conversation
|
@llvm/pr-subscribers-clangir @llvm/pr-subscribers-clang Author: Akimasa Watanuki (Men-cotton) ChangesIn Update clang/test/CIR/CodeGenHLSL/matrix-element-expr-load.hlsl to use Full diff: https://github.com/llvm/llvm-project/pull/182817.diff 2 Files Affected:
diff --git a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
index d523aa2fdb737..e5f17d720ee86 100644
--- a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
@@ -2371,9 +2371,12 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *ce) {
case CK_VectorSplat: {
// Create a vector object and fill all elements with the same scalar value.
assert(destTy->isVectorType() && "CK_VectorSplat to non-vector type");
+ mlir::Value scalar = Visit(subExpr);
+ if (!scalar)
+ return {};
return cir::VecSplatOp::create(builder,
cgf.getLoc(subExpr->getSourceRange()),
- cgf.convertType(destTy), Visit(subExpr));
+ cgf.convertType(destTy), scalar);
}
case CK_FunctionToPointerDecay:
return cgf.emitLValue(subExpr).getPointer();
diff --git a/clang/test/CIR/CodeGenHLSL/matrix-element-expr-load.hlsl b/clang/test/CIR/CodeGenHLSL/matrix-element-expr-load.hlsl
index 279075a6dab60..f3c6d1fefd1f0 100644
--- a/clang/test/CIR/CodeGenHLSL/matrix-element-expr-load.hlsl
+++ b/clang/test/CIR/CodeGenHLSL/matrix-element-expr-load.hlsl
@@ -1,8 +1,8 @@
-// RUN: not %clang_cc1 -x hlsl -finclude-default-header -triple spirv-unknown-vulkan-compute %s \
-// RUN: -fclangir -emit-cir -disable-llvm-passes 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -x hlsl -finclude-default-header -triple spirv-unknown-vulkan-compute %s \
+// RUN: -fclangir -emit-cir -disable-llvm-passes -verify
-// CHECK: ClangIR code gen Not Yet Implemented: processing of type: ConstantMatrix
-float1 test_zero_indexed(float2x2 M) {
- // CHECK: ClangIR code gen Not Yet Implemented: ScalarExprEmitter: matrix element
- return M._m00;
+// expected-error@*:* {{ClangIR code gen Not Yet Implemented: processing of type: ConstantMatrix}}
+float1 test_zero_indexed(float2x2 M) {
+ // expected-error@+1 {{ClangIR code gen Not Yet Implemented: ScalarExprEmitter: matrix element}}
+ return M._m00;
}
|
|
The motivation behind this PR is to resolve the following error seen in recent CI checks: |
erichkeane
left a comment
There was a problem hiding this comment.
Note I merged a fix for this test yesterday as well that was to just update the test to use float instead of float1, so it doesn't fail.
However, the 'crash' we're hitting is because of an NYI. And this fix just 'passes' the failure onto the caller of this, and will cause the same problems elsewhere.
IMO, we don't want to be doing this.
| // Create a vector object and fill all elements with the same scalar value. | ||
| assert(destTy->isVectorType() && "CK_VectorSplat to non-vector type"); | ||
| mlir::Value scalar = Visit(subExpr); | ||
| if (!scalar) |
There was a problem hiding this comment.
THIS is something that should never happen, right? It only does because we're not yet implemented. IMO, we shouldn't introduce a branch that should go away later.
| float test_zero_indexed(float2x2 M) { | ||
| // CHECK: ClangIR code gen Not Yet Implemented: ScalarExprEmitter: matrix element | ||
| return M._m00; | ||
| // expected-error@*:* {{ClangIR code gen Not Yet Implemented: processing of type: ConstantMatrix}} |
There was a problem hiding this comment.
This is probably not a bad change either.
|
Approved for the test change. The rest should be reviewed by a CIR developer |
🐧 Linux x64 Test Results
✅ The build succeeded and all tests passed. |
CK_VectorSplat on failed scalar emission-verify on clang/test/CIR/CodeGenHLSL/matrix-element-expr-load.hlsl
|
I've reverted the I noticed there are other tests in I'm happy to clean those up as well if you'd like. Or, if this cleanup isn't necessary right now, I just close this PR. |
There is likely value in cleaning those up as well. |
…-load.hlsl (llvm#182817) Update clang/test/CIR/CodeGenHLSL/matrix-element-expr-load.hlsl to use `-verify` with expected CIR NYI diagnostics.
…-load.hlsl (llvm#182817) Update clang/test/CIR/CodeGenHLSL/matrix-element-expr-load.hlsl to use `-verify` with expected CIR NYI diagnostics.
Update clang/test/CIR/CodeGenHLSL/matrix-element-expr-load.hlsl to use
-verifywith expected CIR NYI diagnostics.