From e277346f434ed4a79b20bd0976c529da82f3ba5c Mon Sep 17 00:00:00 2001 From: Mahmood Yassin Date: Mon, 17 Nov 2025 10:21:36 +0200 Subject: [PATCH 1/3] [CIR] Emit bitcast for equal-width types Implement VisitAsTypeExpr to lower AsTypeExpr expressions. - Emit an error when source and destination types differ in bitwidth. - When types already match, return the source value (no-op). - Otherwise lower to a CIR bitcast using cir::CastOp with CastKind::bitcast. --- clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp | 29 ++++++++++++++++++- .../CIR/CodeGen/OpenCL/vec_int_as_float.cl | 9 ++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 clang/test/CIR/CodeGen/OpenCL/vec_int_as_float.cl diff --git a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp index b6b114f0e4b9..2f1c719a8b1f 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp @@ -820,7 +820,34 @@ class ScalarExprEmitter : public StmtVisitor { mlir::Value VisitObjCDictionaryLiteral(ObjCDictionaryLiteral *E) { llvm_unreachable("NYI"); } - mlir::Value VisitAsTypeExpr(AsTypeExpr *E) { llvm_unreachable("NYI"); } + + mlir::Value VisitAsTypeExpr(AsTypeExpr *E) { + mlir::Value src = CGF.emitScalarExpr(E->getSrcExpr()); + QualType qualSrcTy = E->getSrcExpr()->getType(); + QualType qualDstTy = E->getType(); + + // Bitwidth check + unsigned srcBits = CGF.getContext().getTypeSize(qualSrcTy); + unsigned dstBits = CGF.getContext().getTypeSize(qualDstTy); + if (srcBits != dstBits) { + emitError(CGF.getLoc(E->getExprLoc()), + "source and destination must have equal bitwidths: '" + + llvm::Twine(srcBits) + "' vs '" + llvm::Twine(dstBits) + + "'"); + return nullptr; + } + + // No-op if already same type + mlir::Type srcTy = CGF.convertType(qualSrcTy); + mlir::Type dstTy = CGF.convertType(qualDstTy); + if (srcTy == dstTy) + return src; + + // Perform the bitcast + auto loc = CGF.getLoc(E->getExprLoc()); + return Builder.create(loc, dstTy, cir::CastKind::bitcast, src); + } + mlir::Value VisitAtomicExpr(AtomicExpr *E) { return CGF.emitAtomicExpr(E).getScalarVal(); } diff --git a/clang/test/CIR/CodeGen/OpenCL/vec_int_as_float.cl b/clang/test/CIR/CodeGen/OpenCL/vec_int_as_float.cl new file mode 100644 index 000000000000..75d5de1063e0 --- /dev/null +++ b/clang/test/CIR/CodeGen/OpenCL/vec_int_as_float.cl @@ -0,0 +1,9 @@ +// RUN: %clang -target x86_64-unknown-linux-gnu -cl-std=CL3.0 -Xclang -finclude-default-header -Xclang -fclangir -emit-cir %s -o - | FileCheck %s + +float4 test(int4 in) +{ + return as_float4(in); // Bit reinterpretation +} + +// CHECK: [[LOAD:%.*]] = cir.load align(16) %{{.*}} : !cir.ptr>, !cir.vector +// CHECK: %{{.*}} = cir.cast bitcast [[LOAD]] : !cir.vector -> !cir.vector \ No newline at end of file From 411a74a379e43bd3cd72da6e377a54dce33c123a Mon Sep 17 00:00:00 2001 From: Mahmood Yassin Date: Thu, 20 Nov 2025 11:09:26 +0200 Subject: [PATCH 2/3] fix VisitAsTypeExpr to align with OG codegen --- clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp | 44 ++++++++++++------- clang/test/CIR/CodeGen/OpenCL/as_type.cl | 43 ++++++++++++++++++ .../CIR/CodeGen/OpenCL/vec_int_as_float.cl | 9 ---- 3 files changed, 72 insertions(+), 24 deletions(-) create mode 100644 clang/test/CIR/CodeGen/OpenCL/as_type.cl delete mode 100644 clang/test/CIR/CodeGen/OpenCL/vec_int_as_float.cl diff --git a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp index 2f1c719a8b1f..cea2cf306d5b 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp @@ -826,26 +826,40 @@ class ScalarExprEmitter : public StmtVisitor { QualType qualSrcTy = E->getSrcExpr()->getType(); QualType qualDstTy = E->getType(); - // Bitwidth check - unsigned srcBits = CGF.getContext().getTypeSize(qualSrcTy); - unsigned dstBits = CGF.getContext().getTypeSize(qualDstTy); - if (srcBits != dstBits) { - emitError(CGF.getLoc(E->getExprLoc()), - "source and destination must have equal bitwidths: '" + - llvm::Twine(srcBits) + "' vs '" + llvm::Twine(dstBits) + - "'"); - return nullptr; - } - - // No-op if already same type mlir::Type srcTy = CGF.convertType(qualSrcTy); mlir::Type dstTy = CGF.convertType(qualDstTy); + auto loc = CGF.getLoc(E->getExprLoc()); + + unsigned numSrcElems = 0, numDstElems = 0; + if (auto v = dyn_cast(srcTy)) + numSrcElems = v.getSize(); + if (auto v = dyn_cast(dstTy)) + numDstElems = v.getSize(); + + // Use bit vector expansion for ext_vector_type boolean vectors. + if (qualDstTy->isExtVectorBoolType()) { + llvm_unreachable("NYI"); + } + + // Going from vec3 to non-vec3 is a special case and requires a shuffle + // vector to get a vec4, then a bitcast if the target type is different. + if (numSrcElems == 3 && numDstElems != 3) { + llvm_unreachable("NYI"); + } + + // Going from non-vec3 to vec3 is a special case and requires a bitcast + // to vec4 if the original type is not vec4, then a shuffle vector to + // get a vec3. + if (numSrcElems != 3 && numDstElems == 3) { + llvm_unreachable("NYI"); + } + + // If types are identical, return the source if (srcTy == dstTy) return src; - // Perform the bitcast - auto loc = CGF.getLoc(E->getExprLoc()); - return Builder.create(loc, dstTy, cir::CastKind::bitcast, src); + // Otherwise, fallback to CIR bitcast + return cir::CastOp::create(Builder, loc, dstTy, cir::CastKind::bitcast, src); } mlir::Value VisitAtomicExpr(AtomicExpr *E) { diff --git a/clang/test/CIR/CodeGen/OpenCL/as_type.cl b/clang/test/CIR/CodeGen/OpenCL/as_type.cl new file mode 100644 index 000000000000..5a8043b5cf94 --- /dev/null +++ b/clang/test/CIR/CodeGen/OpenCL/as_type.cl @@ -0,0 +1,43 @@ +// RUN: %clang_cc1 %s -cl-std=CL2.0 -fclangir -emit-cir -triple spirv64-unknown-unknown -o %t.ll +// RUN: FileCheck %s --input-file=%t.ll --check-prefix=CIR + +// RUN: %clang_cc1 %s -cl-std=CL2.0 -fclangir -emit-llvm -triple spirv64-unknown-unknown -o %t.ll +// RUN: FileCheck %s --input-file=%t.ll --check-prefix=LLVM + +// RUN: %clang_cc1 %s -cl-std=CL2.0 -emit-llvm -triple spirv64-unknown-unknown -o %t.ll +// RUN: FileCheck %s --input-file=%t.ll --check-prefix=OG-LLVM + +typedef __attribute__(( ext_vector_type(3) )) char char3; +typedef __attribute__(( ext_vector_type(4) )) char char4; +typedef __attribute__(( ext_vector_type(16) )) char char16; +typedef __attribute__(( ext_vector_type(3) )) int int3; + +//CIR: cir.func @f4(%{{.*}}: !s32i loc({{.*}})) -> !cir.vector +//CIR: %[[x:.*]] = cir.load align(4) %{{.*}} : !cir.ptr +//CIR: cir.cast bitcast %[[x]] : !s32i -> !cir.vector +//LLVM: define spir_func <4 x i8> @f4(i32 %[[x:.*]]) +//LLVM: %[[astype:.*]] = bitcast i32 %[[x]] to <4 x i8> +//LLVM-NOT: shufflevector +//LLVM: ret <4 x i8> %[[astype]] +//OG-LLVM: define spir_func noundef <4 x i8> @f4(i32 noundef %[[x:.*]]) +//OG-LLVM: %[[astype:.*]] = bitcast i32 %[[x]] to <4 x i8> +//OG-LLVM-NOT: shufflevector +//OG-LLVM: ret <4 x i8> %[[astype]] +char4 f4(int x) { + return __builtin_astype(x, char4); +} + +//CIR: cir.func @f6(%{{.*}}: !cir.vector loc({{.*}})) -> !s32i +//CIR: %[[x:.*]] = cir.load align(4) %{{.*}} : !cir.ptr, addrspace(offload_private)>, !cir.vector +//CIR: cir.cast bitcast %[[x]] : !cir.vector -> !s32i +//LLVM: define{{.*}} spir_func i32 @f6(<4 x i8> %[[x:.*]]) +//LLVM: %[[astype:.*]] = bitcast <4 x i8> %[[x]] to i32 +//LLVM-NOT: shufflevector +//LLVM: ret i32 %[[astype]] +//OG-LLVM: define{{.*}} spir_func noundef i32 @f6(<4 x i8> noundef %[[x:.*]]) +//OG-LLVM: %[[astype:.*]] = bitcast <4 x i8> %[[x]] to i32 +//OG-LLVM-NOT: shufflevector +//OG-LLVM: ret i32 %[[astype]] +int f6(char4 x) { + return __builtin_astype(x, int); +} \ No newline at end of file diff --git a/clang/test/CIR/CodeGen/OpenCL/vec_int_as_float.cl b/clang/test/CIR/CodeGen/OpenCL/vec_int_as_float.cl deleted file mode 100644 index 75d5de1063e0..000000000000 --- a/clang/test/CIR/CodeGen/OpenCL/vec_int_as_float.cl +++ /dev/null @@ -1,9 +0,0 @@ -// RUN: %clang -target x86_64-unknown-linux-gnu -cl-std=CL3.0 -Xclang -finclude-default-header -Xclang -fclangir -emit-cir %s -o - | FileCheck %s - -float4 test(int4 in) -{ - return as_float4(in); // Bit reinterpretation -} - -// CHECK: [[LOAD:%.*]] = cir.load align(16) %{{.*}} : !cir.ptr>, !cir.vector -// CHECK: %{{.*}} = cir.cast bitcast [[LOAD]] : !cir.vector -> !cir.vector \ No newline at end of file From 898b7ccbe206e874178b08d2367addf3286cd197 Mon Sep 17 00:00:00 2001 From: Mahmood Yassin Date: Sun, 23 Nov 2025 14:09:50 +0200 Subject: [PATCH 3/3] Add createCastsForTypeOfSameSize --- .../CIR/Dialect/Builder/CIRBaseBuilder.h | 27 +++++++- clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp | 63 ++++++++++++++----- clang/lib/CIR/Dialect/IR/CIRDialect.cpp | 6 +- clang/test/CIR/CodeGen/OpenCL/as_type.cl | 62 ++++++++++-------- clang/test/CIR/IR/invalid.cir | 9 --- 5 files changed, 115 insertions(+), 52 deletions(-) diff --git a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h index a533bea6f1e6..cf9b7ed15e67 100644 --- a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h +++ b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h @@ -574,7 +574,9 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { mlir::Value createPtrBitcast(mlir::Value src, mlir::Type newPointeeTy) { assert(mlir::isa(src.getType()) && "expected ptr src"); - return createBitcast(src, getPointerTo(newPointeeTy)); + auto srcPtrTy = mlir::cast(src.getType()); + mlir::Type newPtrTy = getPointerTo(newPointeeTy, srcPtrTy.getAddrSpace()); + return createBitcast(src, newPtrTy); } mlir::Value createAddrSpaceCast(mlir::Location loc, mlir::Value src, @@ -586,6 +588,29 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { return createAddrSpaceCast(src.getLoc(), src, newTy); } + mlir::Value createPointerBitCastOrAddrSpaceCast(mlir::Location loc, + mlir::Value src, + mlir::Type newPointerTy) { + assert(mlir::isa(src.getType()) && + "expected source pointer"); + assert(mlir::isa(newPointerTy) && + "expected destination pointer type"); + + auto srcPtrTy = mlir::cast(src.getType()); + auto dstPtrTy = mlir::cast(newPointerTy); + + mlir::Value addrSpaceCasted = src; + if (srcPtrTy.getAddrSpace() != dstPtrTy.getAddrSpace()) + addrSpaceCasted = createAddrSpaceCast(loc, src, dstPtrTy); + + return createPtrBitcast(addrSpaceCasted, dstPtrTy.getPointee()); + } + + mlir::Value createPointerBitCastOrAddrSpaceCast(mlir::Value src, + mlir::Type newPointerTy) { + return createPointerBitCastOrAddrSpaceCast(src.getLoc(), src, newPointerTy); + } + mlir::Value createPtrIsNull(mlir::Value ptr) { return createNot(createPtrToBoolCast(ptr)); } diff --git a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp index cea2cf306d5b..17241b806c56 100644 --- a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp @@ -821,20 +821,56 @@ class ScalarExprEmitter : public StmtVisitor { llvm_unreachable("NYI"); } + // Create cast instructions for converting LLVM value Src to MLIR type DstTy. + // Src has the same size as DstTy. Both are single value types + // but could be scalar or vectors of different lengths, and either can be + // pointer. + mlir::Value createCastsForTypeOfSameSize(mlir::Value Src, mlir::Type DstTy) { + auto SrcTy = Src.getType(); + + // Case 1. + if (!isa(SrcTy) && !isa(DstTy)) + return Builder.createBitcast(Src, DstTy); + + // Case 2. + if (isa(SrcTy) && isa(DstTy)) + return Builder.createPointerBitCastOrAddrSpaceCast(Src, DstTy); + + // Case 3. + if (isa(SrcTy) && !isa(DstTy)) { + // Case 3b. + if (!Builder.isInt(DstTy)) + llvm_unreachable("NYI"); + // Cases 3a and 3b. + llvm_unreachable("NYI"); + } + + // Case 4b. + if (!Builder.isInt(SrcTy)) + llvm_unreachable("NYI"); + + // Cases 4a and 4b. + llvm_unreachable("NYI"); + } + mlir::Value VisitAsTypeExpr(AsTypeExpr *E) { - mlir::Value src = CGF.emitScalarExpr(E->getSrcExpr()); + unsigned numSrcElems = 0; QualType qualSrcTy = E->getSrcExpr()->getType(); - QualType qualDstTy = E->getType(); - mlir::Type srcTy = CGF.convertType(qualSrcTy); - mlir::Type dstTy = CGF.convertType(qualDstTy); - auto loc = CGF.getLoc(E->getExprLoc()); - - unsigned numSrcElems = 0, numDstElems = 0; - if (auto v = dyn_cast(srcTy)) + if (auto v = dyn_cast(srcTy)) { + assert(!cir::MissingFeatures::scalableVectors() && + "NYI: non-fixed (scalable) vector src"); numSrcElems = v.getSize(); - if (auto v = dyn_cast(dstTy)) + } + + unsigned numDstElems = 0; + QualType qualDstTy = E->getType(); + mlir::Type dstTy = CGF.convertType(qualDstTy); + if (auto v = dyn_cast(dstTy)) { + assert(!cir::MissingFeatures::scalableVectors() && + "NYI: non-fixed (scalable) vector dst"); numDstElems = v.getSize(); + } // Use bit vector expansion for ext_vector_type boolean vectors. if (qualDstTy->isExtVectorBoolType()) { @@ -854,12 +890,9 @@ class ScalarExprEmitter : public StmtVisitor { llvm_unreachable("NYI"); } - // If types are identical, return the source - if (srcTy == dstTy) - return src; - - // Otherwise, fallback to CIR bitcast - return cir::CastOp::create(Builder, loc, dstTy, cir::CastKind::bitcast, src); + // Otherwise, fallback to bitcast of same size + mlir::Value src = CGF.emitScalarExpr(E->getSrcExpr()); + return createCastsForTypeOfSameSize(src, dstTy); } mlir::Value VisitAtomicExpr(AtomicExpr *E) { diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp index 4387142ac8c5..cecaade6a4dc 100644 --- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp +++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp @@ -662,8 +662,10 @@ LogicalResult cir::CastOp::verify() { auto resPtrTy = mlir::dyn_cast(resType); if (!srcPtrTy || !resPtrTy) return emitOpError() << "requires !cir.ptr type for source and result"; - if (srcPtrTy.getPointee() != resPtrTy.getPointee()) - return emitOpError() << "requires two types differ in addrspace only"; + // Address space verification is sufficient here. The pointee types need not + // be verified as they are handled by bitcast verification logic, which + // ensures address space compatibility. Verifying pointee types would create + // a circular dependency between address space and pointee type casting. return success(); } case cir::CastKind::float_to_complex: { diff --git a/clang/test/CIR/CodeGen/OpenCL/as_type.cl b/clang/test/CIR/CodeGen/OpenCL/as_type.cl index 5a8043b5cf94..6fc8104e8a24 100644 --- a/clang/test/CIR/CodeGen/OpenCL/as_type.cl +++ b/clang/test/CIR/CodeGen/OpenCL/as_type.cl @@ -7,37 +7,49 @@ // RUN: %clang_cc1 %s -cl-std=CL2.0 -emit-llvm -triple spirv64-unknown-unknown -o %t.ll // RUN: FileCheck %s --input-file=%t.ll --check-prefix=OG-LLVM -typedef __attribute__(( ext_vector_type(3) )) char char3; typedef __attribute__(( ext_vector_type(4) )) char char4; -typedef __attribute__(( ext_vector_type(16) )) char char16; -typedef __attribute__(( ext_vector_type(3) )) int int3; -//CIR: cir.func @f4(%{{.*}}: !s32i loc({{.*}})) -> !cir.vector -//CIR: %[[x:.*]] = cir.load align(4) %{{.*}} : !cir.ptr -//CIR: cir.cast bitcast %[[x]] : !s32i -> !cir.vector -//LLVM: define spir_func <4 x i8> @f4(i32 %[[x:.*]]) -//LLVM: %[[astype:.*]] = bitcast i32 %[[x]] to <4 x i8> -//LLVM-NOT: shufflevector -//LLVM: ret <4 x i8> %[[astype]] -//OG-LLVM: define spir_func noundef <4 x i8> @f4(i32 noundef %[[x:.*]]) -//OG-LLVM: %[[astype:.*]] = bitcast i32 %[[x]] to <4 x i8> -//OG-LLVM-NOT: shufflevector -//OG-LLVM: ret <4 x i8> %[[astype]] +// CIR: cir.func @f4(%{{.*}}: !s32i loc({{.*}})) -> !cir.vector +// CIR: %[[x:.*]] = cir.load align(4) %{{.*}} : !cir.ptr +// CIR: cir.cast bitcast %[[x]] : !s32i -> !cir.vector +// LLVM: define spir_func <4 x i8> @f4(i32 %[[x:.*]]) +// LLVM: %[[astype:.*]] = bitcast i32 %[[x]] to <4 x i8> +// LLVM-NOT: shufflevector +// LLVM: ret <4 x i8> %[[astype]] +// OG-LLVM: define spir_func noundef <4 x i8> @f4(i32 noundef %[[x:.*]]) +// OG-LLVM: %[[astype:.*]] = bitcast i32 %[[x]] to <4 x i8> +// OG-LLVM-NOT: shufflevector +// OG-LLVM: ret <4 x i8> %[[astype]] char4 f4(int x) { return __builtin_astype(x, char4); } -//CIR: cir.func @f6(%{{.*}}: !cir.vector loc({{.*}})) -> !s32i -//CIR: %[[x:.*]] = cir.load align(4) %{{.*}} : !cir.ptr, addrspace(offload_private)>, !cir.vector -//CIR: cir.cast bitcast %[[x]] : !cir.vector -> !s32i -//LLVM: define{{.*}} spir_func i32 @f6(<4 x i8> %[[x:.*]]) -//LLVM: %[[astype:.*]] = bitcast <4 x i8> %[[x]] to i32 -//LLVM-NOT: shufflevector -//LLVM: ret i32 %[[astype]] -//OG-LLVM: define{{.*}} spir_func noundef i32 @f6(<4 x i8> noundef %[[x:.*]]) -//OG-LLVM: %[[astype:.*]] = bitcast <4 x i8> %[[x]] to i32 -//OG-LLVM-NOT: shufflevector -//OG-LLVM: ret i32 %[[astype]] +// CIR: cir.func @f6(%{{.*}}: !cir.vector loc({{.*}})) -> !s32i +// CIR: %[[x:.*]] = cir.load align(4) %{{.*}} : !cir.ptr, addrspace(offload_private)>, !cir.vector +// CIR: cir.cast bitcast %[[x]] : !cir.vector -> !s32i +// LLVM: define{{.*}} spir_func i32 @f6(<4 x i8> %[[x:.*]]) +// LLVM: %[[astype:.*]] = bitcast <4 x i8> %[[x]] to i32 +// LLVM-NOT: shufflevector +// LLVM: ret i32 %[[astype]] +// OG-LLVM: define{{.*}} spir_func noundef i32 @f6(<4 x i8> noundef %[[x:.*]]) +// OG-LLVM: %[[astype:.*]] = bitcast <4 x i8> %[[x]] to i32 +// OG-LLVM-NOT: shufflevector +// OG-LLVM: ret i32 %[[astype]] int f6(char4 x) { return __builtin_astype(x, int); +} + +// CIR: cir.func @f4_ptr(%{{.*}}: !cir.ptr loc({{.*}})) -> !cir.ptr, addrspace(offload_local)> +// CIR: %[[x:.*]] = cir.load align(8) %{{.*}} : !cir.ptr, addrspace(offload_private)>, !cir.ptr +// CIR: cir.cast address_space %[[x]] : !cir.ptr -> !cir.ptr, addrspace(offload_local)> +// LLVM: define spir_func ptr addrspace(3) @f4_ptr(ptr addrspace(1) readnone captures(ret: address, provenance) %[[x:.*]]) +// LLVM: %[[astype:.*]] = addrspacecast ptr addrspace(1) %[[x]] to ptr addrspace(3) +// LLVM-NOT: shufflevector +// LLVM: ret ptr addrspace(3) %[[astype]] +// OG-LLVM: define spir_func ptr addrspace(3) @f4_ptr(ptr addrspace(1) noundef readnone captures(ret: address, provenance) %[[x:.*]]) +// OG-LLVM: %[[astype:.*]] = addrspacecast ptr addrspace(1) %[[x]] to ptr addrspace(3) +// OG-LLVM-NOT: shufflevector +// OG-LLVM: ret ptr addrspace(3) %[[astype]] +__local char4* f4_ptr(__global int* x) { + return __builtin_astype(x, __local char4*); } \ No newline at end of file diff --git a/clang/test/CIR/IR/invalid.cir b/clang/test/CIR/IR/invalid.cir index f9a7bb92c656..70846ac264cd 100644 --- a/clang/test/CIR/IR/invalid.cir +++ b/clang/test/CIR/IR/invalid.cir @@ -300,15 +300,6 @@ cir.func @cast24(%p : !u32i) { // ----- -!u32i = !cir.int -!u64i = !cir.int -cir.func @cast25(%p : !cir.ptr)>) { - %0 = cir.cast address_space %p : !cir.ptr)> -> !cir.ptr)> // expected-error {{requires two types differ in addrspace only}} - cir.return -} - -// ----- - !u64i = !cir.int cir.func @cast26(%p : !cir.ptr)>) { %0 = cir.cast address_space %p : !cir.ptr)> -> !u64i // expected-error {{requires !cir.ptr type for source and result}}