diff --git a/clang/test/OpenMP/cancel_codegen.cpp b/clang/test/OpenMP/cancel_codegen.cpp index 53580e0c2b029..03024cf331b27 100644 --- a/clang/test/OpenMP/cancel_codegen.cpp +++ b/clang/test/OpenMP/cancel_codegen.cpp @@ -1026,25 +1026,25 @@ for (int i = 0; i < argc; ++i) { // CHECK3-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META8:![0-9]+]]) // CHECK3-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META10:![0-9]+]]) // CHECK3-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META12:![0-9]+]]) -// CHECK3-NEXT: store i32 [[TMP2]], ptr [[DOTGLOBAL_TID__ADDR_I]], align 4, !noalias !14 -// CHECK3-NEXT: store ptr [[TMP5]], ptr [[DOTPART_ID__ADDR_I]], align 8, !noalias !14 -// CHECK3-NEXT: store ptr null, ptr [[DOTPRIVATES__ADDR_I]], align 8, !noalias !14 -// CHECK3-NEXT: store ptr null, ptr [[DOTCOPY_FN__ADDR_I]], align 8, !noalias !14 -// CHECK3-NEXT: store ptr [[TMP3]], ptr [[DOTTASK_T__ADDR_I]], align 8, !noalias !14 -// CHECK3-NEXT: store ptr [[TMP7]], ptr [[__CONTEXT_ADDR_I]], align 8, !noalias !14 -// CHECK3-NEXT: [[TMP8:%.*]] = load ptr, ptr [[__CONTEXT_ADDR_I]], align 8, !noalias !14 +// CHECK3-NEXT: store i32 [[TMP2]], ptr [[DOTGLOBAL_TID__ADDR_I]], align 4, !noalias ![[NOALIAS0:[0-9]+]] +// CHECK3-NEXT: store ptr [[TMP5]], ptr [[DOTPART_ID__ADDR_I]], align 8, !noalias ![[NOALIAS0]] +// CHECK3-NEXT: store ptr null, ptr [[DOTPRIVATES__ADDR_I]], align 8, !noalias ![[NOALIAS0]] +// CHECK3-NEXT: store ptr null, ptr [[DOTCOPY_FN__ADDR_I]], align 8, !noalias ![[NOALIAS0]] +// CHECK3-NEXT: store ptr [[TMP3]], ptr [[DOTTASK_T__ADDR_I]], align 8, !noalias ![[NOALIAS0]] +// CHECK3-NEXT: store ptr [[TMP7]], ptr [[__CONTEXT_ADDR_I]], align 8, !noalias ![[NOALIAS0]] +// CHECK3-NEXT: [[TMP8:%.*]] = load ptr, ptr [[__CONTEXT_ADDR_I]], align 8, !noalias ![[NOALIAS0]] // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM_I:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB12:[0-9]+]]) // CHECK3-NEXT: [[TMP9:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[OMP_GLOBAL_THREAD_NUM_I]], i32 4) // CHECK3-NEXT: [[TMP10:%.*]] = icmp ne i32 [[TMP9]], 0 // CHECK3-NEXT: br i1 [[TMP10]], label [[DOTCANCEL_EXIT_I:%.*]], label [[DOTCANCEL_CONTINUE_I:%.*]] // CHECK3: .cancel.exit.i: -// CHECK3-NEXT: store i32 1, ptr [[CLEANUP_DEST_SLOT_I]], align 4, !noalias !14 +// CHECK3-NEXT: store i32 1, ptr [[CLEANUP_DEST_SLOT_I]], align 4, !noalias ![[NOALIAS1:[0-9]+]] // CHECK3-NEXT: br label [[DOTOMP_OUTLINED__EXIT:%.*]] // CHECK3: .cancel.continue.i: -// CHECK3-NEXT: store i32 0, ptr [[CLEANUP_DEST_SLOT_I]], align 4, !noalias !14 +// CHECK3-NEXT: store i32 0, ptr [[CLEANUP_DEST_SLOT_I]], align 4, !noalias ![[NOALIAS1]] // CHECK3-NEXT: br label [[DOTOMP_OUTLINED__EXIT]] // CHECK3: .omp_outlined..exit: -// CHECK3-NEXT: [[CLEANUP_DEST_I:%.*]] = load i32, ptr [[CLEANUP_DEST_SLOT_I]], align 4, !noalias !14 +// CHECK3-NEXT: [[CLEANUP_DEST_I:%.*]] = load i32, ptr [[CLEANUP_DEST_SLOT_I]], align 4, !noalias ![[NOALIAS1]] // CHECK3-NEXT: ret i32 0 // // diff --git a/clang/test/OpenMP/parallel_codegen.cpp b/clang/test/OpenMP/parallel_codegen.cpp index 5c98761be0808..d545b4a9d9fa8 100644 --- a/clang/test/OpenMP/parallel_codegen.cpp +++ b/clang/test/OpenMP/parallel_codegen.cpp @@ -812,7 +812,7 @@ int main (int argc, char **argv) { // // // CHECK3-LABEL: define {{[^@]+}}@_Z5tmainIPPcEiT_..omp_par -// CHECK3-SAME: (ptr noalias [[TID_ADDR:%.*]], ptr noalias [[ZERO_ADDR:%.*]], ptr [[TMP0:%.*]]) #[[ATTR1]] { +// CHECK3-SAME: (ptr noalias [[TID_ADDR:%.*]], ptr noalias [[ZERO_ADDR:%.*]], ptr [[TMP0:%.*]]) #[[ATTR2:[0-9]+]] // CHECK3-NEXT: omp.par.entry: // CHECK3-NEXT: [[GEP__RELOADED:%.*]] = getelementptr { ptr, ptr }, ptr [[TMP0]], i32 0, i32 0 // CHECK3-NEXT: [[LOADGEP__RELOADED:%.*]] = load ptr, ptr [[GEP__RELOADED]], align 8 @@ -956,7 +956,7 @@ int main (int argc, char **argv) { // // // CHECK4-LABEL: define {{[^@]+}}@_Z5tmainIPPcEiT_..omp_par -// CHECK4-SAME: (ptr noalias [[TID_ADDR:%.*]], ptr noalias [[ZERO_ADDR:%.*]], ptr [[TMP0:%.*]]) #[[ATTR1]] !dbg [[DBG57:![0-9]+]] { +// CHECK4-SAME: (ptr noalias [[TID_ADDR:%.*]], ptr noalias [[ZERO_ADDR:%.*]], ptr [[TMP0:%.*]]) #[[ATTR2:[0-9]+]] !dbg [[DBG57:![0-9]+]] { // CHECK4-NEXT: omp.par.entry: // CHECK4-NEXT: [[GEP__RELOADED:%.*]] = getelementptr { ptr, ptr }, ptr [[TMP0]], i32 0, i32 0 // CHECK4-NEXT: [[LOADGEP__RELOADED:%.*]] = load ptr, ptr [[GEP__RELOADED]], align 8 diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp index 81691a5f69aa0..4651767d0655a 100644 --- a/llvm/lib/IR/ConstantFold.cpp +++ b/llvm/lib/IR/ConstantFold.cpp @@ -37,45 +37,6 @@ using namespace llvm::PatternMatch; // ConstantFold*Instruction Implementations //===----------------------------------------------------------------------===// -/// Convert the specified vector Constant node to the specified vector type. -/// At this point, we know that the elements of the input vector constant are -/// all simple integer or FP values. -static Constant *BitCastConstantVector(Constant *CV, VectorType *DstTy) { - - if (CV->isAllOnesValue()) return Constant::getAllOnesValue(DstTy); - if (CV->isNullValue()) return Constant::getNullValue(DstTy); - - // Do not iterate on scalable vector. The num of elements is unknown at - // compile-time. - if (isa(DstTy)) - return nullptr; - - // If this cast changes element count then we can't handle it here: - // doing so requires endianness information. This should be handled by - // Analysis/ConstantFolding.cpp - unsigned NumElts = cast(DstTy)->getNumElements(); - if (NumElts != cast(CV->getType())->getNumElements()) - return nullptr; - - Type *DstEltTy = DstTy->getElementType(); - // Fast path for splatted constants. - if (Constant *Splat = CV->getSplatValue()) { - return ConstantVector::getSplat(DstTy->getElementCount(), - ConstantExpr::getBitCast(Splat, DstEltTy)); - } - - SmallVector Result; - Type *Ty = IntegerType::get(CV->getContext(), 32); - for (unsigned i = 0; i != NumElts; ++i) { - Constant *C = - ConstantExpr::getExtractElement(CV, ConstantInt::get(Ty, i)); - C = ConstantExpr::getBitCast(C, DstEltTy); - Result.push_back(C); - } - - return ConstantVector::get(Result); -} - /// This function determines which opcode to use to fold two constant cast /// expressions together. It uses CastInst::isEliminableCastPair to determine /// the opcode. Consequently its just a wrapper around that function. @@ -114,38 +75,16 @@ static Constant *FoldBitCast(Constant *V, Type *DestTy) { // Handle casts from one vector constant to another. We know that the src // and dest type have the same size (otherwise its an illegal cast). if (VectorType *DestPTy = dyn_cast(DestTy)) { - if (VectorType *SrcTy = dyn_cast(V->getType())) { - assert(DestPTy->getPrimitiveSizeInBits() == - SrcTy->getPrimitiveSizeInBits() && - "Not cast between same sized vectors!"); - SrcTy = nullptr; - // First, check for null. Undef is already handled. - if (isa(V)) - return Constant::getNullValue(DestTy); - - // Handle ConstantVector and ConstantAggregateVector. - return BitCastConstantVector(V, DestPTy); - } - // Canonicalize scalar-to-vector bitcasts into vector-to-vector bitcasts // This allows for other simplifications (although some of them // can only be handled by Analysis/ConstantFolding.cpp). if (isa(V) || isa(V)) return ConstantExpr::getBitCast(ConstantVector::get(V), DestPTy); + return nullptr; } - // Finally, implement bitcast folding now. The code below doesn't handle - // bitcast right. - if (isa(V)) // ptr->ptr cast. - return ConstantPointerNull::get(cast(DestTy)); - // Handle integral constant input. if (ConstantInt *CI = dyn_cast(V)) { - if (DestTy->isIntegerTy()) - // Integral -> Integral. This is a no-op because the bit widths must - // be the same. Consequently, we just fold to V. - return V; - // See note below regarding the PPC_FP128 restriction. if (DestTy->isFloatingPointTy() && !DestTy->isPPC_FP128Ty()) return ConstantFP::get(DestTy->getContext(), diff --git a/mlir/include/mlir/Conversion/Passes.td b/mlir/include/mlir/Conversion/Passes.td index 00e342f8f30eb..c2f90b8984b97 100644 --- a/mlir/include/mlir/Conversion/Passes.td +++ b/mlir/include/mlir/Conversion/Passes.td @@ -1270,10 +1270,7 @@ def ConvertVectorToLLVMPass : Pass<"convert-vector-to-llvm"> { Option<"x86Vector", "enable-x86vector", "bool", /*default=*/"false", "Enables the use of X86Vector dialect while lowering the vector " - "dialect.">, - Option<"useOpaquePointers", "use-opaque-pointers", "bool", - /*default=*/"true", "Generate LLVM IR using opaque pointers " - "instead of typed pointers"> + "dialect."> ]; } diff --git a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp index 4af58653c8227..75a35b4c801e4 100644 --- a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp +++ b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp @@ -112,19 +112,6 @@ static Value getIndexedPtrs(ConversionPatternRewriter &rewriter, Location loc, base, index); } -// Casts a strided element pointer to a vector pointer. The vector pointer -// will be in the same address space as the incoming memref type. -static Value castDataPtr(ConversionPatternRewriter &rewriter, Location loc, - Value ptr, MemRefType memRefType, Type vt, - const LLVMTypeConverter &converter) { - if (converter.useOpaquePointers()) - return ptr; - - unsigned addressSpace = *converter.getMemRefAddressSpace(memRefType); - auto pType = LLVM::LLVMPointerType::get(vt, addressSpace); - return rewriter.create(loc, pType, ptr); -} - /// Convert `foldResult` into a Value. Integer attribute is converted to /// an LLVM constant op. static Value getAsLLVMValue(OpBuilder &builder, Location loc, @@ -261,10 +248,8 @@ class VectorLoadStoreConversion : public ConvertOpToLLVMPattern { this->typeConverter->convertType(loadOrStoreOp.getVectorType())); Value dataPtr = this->getStridedElementPtr(loc, memRefTy, adaptor.getBase(), adaptor.getIndices(), rewriter); - Value ptr = castDataPtr(rewriter, loc, dataPtr, memRefTy, vtype, - *this->getTypeConverter()); - - replaceLoadOrStoreOp(loadOrStoreOp, adaptor, vtype, ptr, align, rewriter); + replaceLoadOrStoreOp(loadOrStoreOp, adaptor, vtype, dataPtr, align, + rewriter); return success(); } }; @@ -1440,19 +1425,12 @@ class VectorTypeCastOpConversion // Create descriptor. auto desc = MemRefDescriptor::undef(rewriter, loc, llvmTargetDescriptorTy); - Type llvmTargetElementTy = desc.getElementPtrType(); // Set allocated ptr. Value allocated = sourceMemRef.allocatedPtr(rewriter, loc); - if (!getTypeConverter()->useOpaquePointers()) - allocated = - rewriter.create(loc, llvmTargetElementTy, allocated); desc.setAllocatedPtr(rewriter, loc, allocated); // Set aligned ptr. Value ptr = sourceMemRef.alignedPtr(rewriter, loc); - if (!getTypeConverter()->useOpaquePointers()) - ptr = rewriter.create(loc, llvmTargetElementTy, ptr); - desc.setAlignedPtr(rewriter, loc, ptr); // Fill offset 0. auto attr = rewriter.getIntegerAttr(rewriter.getIndexType(), 0); diff --git a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp index b865a2671fff7..4c6d0672d4108 100644 --- a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp +++ b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp @@ -82,7 +82,6 @@ void LowerVectorToLLVMPass::runOnOperation() { // Convert to the LLVM IR dialect. LowerToLLVMOptions options(&getContext()); - options.useOpaquePointers = useOpaquePointers; LLVMTypeConverter converter(&getContext(), options); RewritePatternSet patterns(&getContext()); populateVectorMaskMaterializationPatterns(patterns, force32BitVectorIndices); diff --git a/mlir/test/Conversion/VectorToLLVM/typed-pointers.mlir b/mlir/test/Conversion/VectorToLLVM/typed-pointers.mlir deleted file mode 100644 index 5dbd9a589f392..0000000000000 --- a/mlir/test/Conversion/VectorToLLVM/typed-pointers.mlir +++ /dev/null @@ -1,172 +0,0 @@ -// RUN: mlir-opt %s -convert-vector-to-llvm='use-opaque-pointers=0' -split-input-file | FileCheck %s - -func.func @vector_type_cast(%arg0: memref<8x8x8xf32>) -> memref> { - %0 = vector.type_cast %arg0: memref<8x8x8xf32> to memref> - return %0 : memref> -} -// CHECK-LABEL: @vector_type_cast -// CHECK: llvm.mlir.undef : !llvm.struct<(ptr>>>, ptr>>>, i64)> -// CHECK: %[[allocated:.*]] = llvm.extractvalue {{.*}}[0] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)> -// CHECK: %[[allocatedBit:.*]] = llvm.bitcast %[[allocated]] : !llvm.ptr to !llvm.ptr>>> -// CHECK: llvm.insertvalue %[[allocatedBit]], {{.*}}[0] : !llvm.struct<(ptr>>>, ptr>>>, i64)> -// CHECK: %[[aligned:.*]] = llvm.extractvalue {{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)> -// CHECK: %[[alignedBit:.*]] = llvm.bitcast %[[aligned]] : !llvm.ptr to !llvm.ptr>>> -// CHECK: llvm.insertvalue %[[alignedBit]], {{.*}}[1] : !llvm.struct<(ptr>>>, ptr>>>, i64)> -// CHECK: llvm.mlir.constant(0 : index -// CHECK: llvm.insertvalue {{.*}}[2] : !llvm.struct<(ptr>>>, ptr>>>, i64)> - -// ----- - -func.func @vector_type_cast_non_zero_addrspace(%arg0: memref<8x8x8xf32, 3>) -> memref, 3> { - %0 = vector.type_cast %arg0: memref<8x8x8xf32, 3> to memref, 3> - return %0 : memref, 3> -} -// CHECK-LABEL: @vector_type_cast_non_zero_addrspace -// CHECK: llvm.mlir.undef : !llvm.struct<(ptr>>, 3>, ptr>>, 3>, i64)> -// CHECK: %[[allocated:.*]] = llvm.extractvalue {{.*}}[0] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)> -// CHECK: %[[allocatedBit:.*]] = llvm.bitcast %[[allocated]] : !llvm.ptr to !llvm.ptr>>, 3> -// CHECK: llvm.insertvalue %[[allocatedBit]], {{.*}}[0] : !llvm.struct<(ptr>>, 3>, ptr>>, 3>, i64)> -// CHECK: %[[aligned:.*]] = llvm.extractvalue {{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)> -// CHECK: %[[alignedBit:.*]] = llvm.bitcast %[[aligned]] : !llvm.ptr to !llvm.ptr>>, 3> -// CHECK: llvm.insertvalue %[[alignedBit]], {{.*}}[1] : !llvm.struct<(ptr>>, 3>, ptr>>, 3>, i64)> -// CHECK: llvm.mlir.constant(0 : index -// CHECK: llvm.insertvalue {{.*}}[2] : !llvm.struct<(ptr>>, 3>, ptr>>, 3>, i64)> - -// ----- - -func.func @transfer_read_1d(%A : memref, %base: index) -> vector<17xf32> { - %f7 = arith.constant 7.0: f32 - %f = vector.transfer_read %A[%base], %f7 - {permutation_map = affine_map<(d0) -> (d0)>} : - memref, vector<17xf32> - vector.transfer_write %f, %A[%base] - {permutation_map = affine_map<(d0) -> (d0)>} : - vector<17xf32>, memref - return %f: vector<17xf32> -} -// CHECK-LABEL: func @transfer_read_1d -// CHECK-SAME: %[[MEM:.*]]: memref, -// CHECK-SAME: %[[BASE:.*]]: index) -> vector<17xf32> -// CHECK: %[[C7:.*]] = arith.constant 7.0 -// -// 1. Let dim be the memref dimension, compute the in-bound index (dim - offset) -// CHECK: %[[C0:.*]] = arith.constant 0 : index -// CHECK: %[[DIM:.*]] = memref.dim %[[MEM]], %[[C0]] : memref -// CHECK: %[[BOUND:.*]] = arith.subi %[[DIM]], %[[BASE]] : index -// -// 2. Create a vector with linear indices [ 0 .. vector_length - 1 ]. -// CHECK: %[[linearIndex:.*]] = arith.constant dense -// CHECK-SAME: <[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]> : -// CHECK-SAME: vector<17xi32> -// -// 3. Create bound vector to compute in-bound mask: -// [ 0 .. vector_length - 1 ] < [ dim - offset .. dim - offset ] -// CHECK: %[[btrunc:.*]] = arith.index_cast %[[BOUND]] : index to i32 -// CHECK: %[[boundVecInsert:.*]] = llvm.insertelement %[[btrunc]] -// CHECK: %[[boundVect:.*]] = llvm.shufflevector %[[boundVecInsert]] -// CHECK: %[[mask:.*]] = arith.cmpi slt, %[[linearIndex]], %[[boundVect]] -// CHECK-SAME: : vector<17xi32> -// -// 4. Create pass-through vector. -// CHECK: %[[PASS_THROUGH:.*]] = arith.constant dense<7.{{.*}}> : vector<17xf32> -// -// 5. Bitcast to vector form. -// CHECK: %[[gep:.*]] = llvm.getelementptr %{{.*}} : -// CHECK-SAME: (!llvm.ptr, i64) -> !llvm.ptr -// CHECK: %[[vecPtr:.*]] = llvm.bitcast %[[gep]] : -// CHECK-SAME: !llvm.ptr to !llvm.ptr> -// -// 6. Rewrite as a masked read. -// CHECK: %[[loaded:.*]] = llvm.intr.masked.load %[[vecPtr]], %[[mask]], -// CHECK-SAME: %[[PASS_THROUGH]] {alignment = 4 : i32} : -// -// 1. Let dim be the memref dimension, compute the in-bound index (dim - offset) -// CHECK: %[[C0_b:.*]] = arith.constant 0 : index -// CHECK: %[[DIM_b:.*]] = memref.dim %[[MEM]], %[[C0_b]] : memref -// CHECK: %[[BOUND_b:.*]] = arith.subi %[[DIM_b]], %[[BASE]] : index -// -// 2. Create a vector with linear indices [ 0 .. vector_length - 1 ]. -// CHECK: %[[linearIndex_b:.*]] = arith.constant dense -// CHECK-SAME: <[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]> : -// CHECK-SAME: vector<17xi32> -// -// 3. Create bound vector to compute in-bound mask: -// [ 0 .. vector_length - 1 ] < [ dim - offset .. dim - offset ] -// CHECK: %[[btrunc_b:.*]] = arith.index_cast %[[BOUND_b]] : index to i32 -// CHECK: %[[boundVecInsert_b:.*]] = llvm.insertelement %[[btrunc_b]] -// CHECK: %[[boundVect_b:.*]] = llvm.shufflevector %[[boundVecInsert_b]] -// CHECK: %[[mask_b:.*]] = arith.cmpi slt, %[[linearIndex_b]], -// CHECK-SAME: %[[boundVect_b]] : vector<17xi32> -// -// 4. Bitcast to vector form. -// CHECK: %[[gep_b:.*]] = llvm.getelementptr {{.*}} : -// CHECK-SAME: (!llvm.ptr, i64) -> !llvm.ptr -// CHECK: %[[vecPtr_b:.*]] = llvm.bitcast %[[gep_b]] : -// CHECK-SAME: !llvm.ptr to !llvm.ptr> -// -// 5. Rewrite as a masked write. -// CHECK: llvm.intr.masked.store %[[loaded]], %[[vecPtr_b]], %[[mask_b]] -// CHECK-SAME: {alignment = 4 : i32} : -// CHECK-SAME: vector<17xf32>, vector<17xi1> into !llvm.ptr> - -// ----- - -func.func @vector_load_op(%memref : memref<200x100xf32>, %i : index, %j : index) -> vector<8xf32> { - %0 = vector.load %memref[%i, %j] : memref<200x100xf32>, vector<8xf32> - return %0 : vector<8xf32> -} - -// CHECK-LABEL: func @vector_load_op -// CHECK: %[[c100:.*]] = llvm.mlir.constant(100 : index) : i64 -// CHECK: %[[mul:.*]] = llvm.mul %{{.*}}, %[[c100]] : i64 -// CHECK: %[[add:.*]] = llvm.add %[[mul]], %{{.*}} : i64 -// CHECK: %[[gep:.*]] = llvm.getelementptr %{{.*}}[%[[add]]] : (!llvm.ptr, i64) -> !llvm.ptr -// CHECK: %[[bcast:.*]] = llvm.bitcast %[[gep]] : !llvm.ptr to !llvm.ptr> -// CHECK: llvm.load %[[bcast]] {alignment = 4 : i64} : !llvm.ptr> - -// ----- - -func.func @vector_store_op(%memref : memref<200x100xf32>, %i : index, %j : index) { - %val = arith.constant dense<11.0> : vector<4xf32> - vector.store %val, %memref[%i, %j] : memref<200x100xf32>, vector<4xf32> - return -} - -// CHECK-LABEL: func @vector_store_op -// CHECK: %[[c100:.*]] = llvm.mlir.constant(100 : index) : i64 -// CHECK: %[[mul:.*]] = llvm.mul %{{.*}}, %[[c100]] : i64 -// CHECK: %[[add:.*]] = llvm.add %[[mul]], %{{.*}} : i64 -// CHECK: %[[gep:.*]] = llvm.getelementptr %{{.*}}[%[[add]]] : (!llvm.ptr, i64) -> !llvm.ptr -// CHECK: %[[bcast:.*]] = llvm.bitcast %[[gep]] : !llvm.ptr to !llvm.ptr> -// CHECK: llvm.store %{{.*}}, %[[bcast]] {alignment = 4 : i64} : !llvm.ptr> - -// ----- - -func.func @masked_load_op(%arg0: memref, %arg1: vector<16xi1>, %arg2: vector<16xf32>) -> vector<16xf32> { - %c0 = arith.constant 0: index - %0 = vector.maskedload %arg0[%c0], %arg1, %arg2 : memref, vector<16xi1>, vector<16xf32> into vector<16xf32> - return %0 : vector<16xf32> -} - -// CHECK-LABEL: func @masked_load_op -// CHECK: %[[CO:.*]] = arith.constant 0 : index -// CHECK: %[[C:.*]] = builtin.unrealized_conversion_cast %[[CO]] : index to i64 -// CHECK: %[[P:.*]] = llvm.getelementptr %{{.*}}[%[[C]]] : (!llvm.ptr, i64) -> !llvm.ptr -// CHECK: %[[B:.*]] = llvm.bitcast %[[P]] : !llvm.ptr to !llvm.ptr> -// CHECK: %[[L:.*]] = llvm.intr.masked.load %[[B]], %{{.*}}, %{{.*}} {alignment = 4 : i32} : (!llvm.ptr>, vector<16xi1>, vector<16xf32>) -> vector<16xf32> -// CHECK: return %[[L]] : vector<16xf32> - -// ----- - -func.func @masked_store_op(%arg0: memref, %arg1: vector<16xi1>, %arg2: vector<16xf32>) { - %c0 = arith.constant 0: index - vector.maskedstore %arg0[%c0], %arg1, %arg2 : memref, vector<16xi1>, vector<16xf32> - return -} - -// CHECK-LABEL: func @masked_store_op -// CHECK: %[[CO:.*]] = arith.constant 0 : index -// CHECK: %[[C:.*]] = builtin.unrealized_conversion_cast %[[CO]] : index to i64 -// CHECK: %[[P:.*]] = llvm.getelementptr %{{.*}}[%[[C]]] : (!llvm.ptr, i64) -> !llvm.ptr -// CHECK: %[[B:.*]] = llvm.bitcast %[[P]] : !llvm.ptr to !llvm.ptr> -// CHECK: llvm.intr.masked.store %{{.*}}, %[[B]], %{{.*}} {alignment = 4 : i32} : vector<16xf32>, vector<16xi1> into !llvm.ptr> diff --git a/mlir/test/Conversion/VectorToLLVM/vector-mask-to-llvm.mlir b/mlir/test/Conversion/VectorToLLVM/vector-mask-to-llvm.mlir index 11354213d9ab4..1abadcc345cd2 100644 --- a/mlir/test/Conversion/VectorToLLVM/vector-mask-to-llvm.mlir +++ b/mlir/test/Conversion/VectorToLLVM/vector-mask-to-llvm.mlir @@ -1,5 +1,5 @@ -// RUN: mlir-opt %s --convert-vector-to-llvm='force-32bit-vector-indices=1 use-opaque-pointers=1' | FileCheck %s --check-prefix=CMP32 -// RUN: mlir-opt %s --convert-vector-to-llvm='force-32bit-vector-indices=0 use-opaque-pointers=1' | FileCheck %s --check-prefix=CMP64 +// RUN: mlir-opt %s --convert-vector-to-llvm='force-32bit-vector-indices=1' | FileCheck %s --check-prefix=CMP32 +// RUN: mlir-opt %s --convert-vector-to-llvm='force-32bit-vector-indices=0' | FileCheck %s --check-prefix=CMP64 // CMP32-LABEL: @genbool_var_1d( // CMP32-SAME: %[[ARG:.*]]: index) diff --git a/mlir/test/Conversion/VectorToLLVM/vector-reduction-to-llvm.mlir b/mlir/test/Conversion/VectorToLLVM/vector-reduction-to-llvm.mlir index 13b7faed4790d..22463f57f24cf 100644 --- a/mlir/test/Conversion/VectorToLLVM/vector-reduction-to-llvm.mlir +++ b/mlir/test/Conversion/VectorToLLVM/vector-reduction-to-llvm.mlir @@ -1,5 +1,5 @@ -// RUN: mlir-opt %s -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file | FileCheck %s -// RUN: mlir-opt %s -convert-vector-to-llvm='reassociate-fp-reductions use-opaque-pointers=1' -split-input-file | FileCheck %s --check-prefix=REASSOC +// RUN: mlir-opt %s -convert-vector-to-llvm -split-input-file | FileCheck %s +// RUN: mlir-opt %s -convert-vector-to-llvm='reassociate-fp-reductions' -split-input-file | FileCheck %s --check-prefix=REASSOC // CHECK-LABEL: @reduce_add_f32( // CHECK-SAME: %[[A:.*]]: vector<16xf32>) diff --git a/mlir/test/Conversion/VectorToLLVM/vector-scalable-memcpy.mlir b/mlir/test/Conversion/VectorToLLVM/vector-scalable-memcpy.mlir index 4a5a203281662..811b10721bf28 100644 --- a/mlir/test/Conversion/VectorToLLVM/vector-scalable-memcpy.mlir +++ b/mlir/test/Conversion/VectorToLLVM/vector-scalable-memcpy.mlir @@ -1,4 +1,4 @@ -// RUN: mlir-opt %s -convert-vector-to-llvm='use-opaque-pointers=1' | mlir-opt | FileCheck %s +// RUN: mlir-opt %s -convert-vector-to-llvm | mlir-opt | FileCheck %s // CHECK: vector_scalable_memcopy([[SRC:%arg[0-9]+]]: memref, [[DST:%arg[0-9]+]] func.func @vector_scalable_memcopy(%src : memref, %dst : memref, %size : index) { diff --git a/mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir b/mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir index 05733214bc3ae..012d30d96799f 100644 --- a/mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir +++ b/mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir @@ -1,5 +1,4 @@ -// RUN: mlir-opt %s -convert-vector-to-llvm='use-opaque-pointers=1' -split-input-file | FileCheck %s - +// RUN: mlir-opt %s -convert-vector-to-llvm -split-input-file | FileCheck %s func.func @bitcast_f32_to_i32_vector_0d(%input: vector) -> vector { %0 = vector.bitcast %input : vector to vector