diff options
| author | River Riddle <riverriddle@google.com> | 2020-01-11 08:54:04 -0800 |
|---|---|---|
| committer | River Riddle <riverriddle@google.com> | 2020-01-11 08:54:39 -0800 |
| commit | 2bdf33cc4c733342fc83081bc7410ac5e9a24f55 (patch) | |
| tree | 3306d769c2bbabda1060928e0cea79d021ea9da2 /mlir/lib/Conversion | |
| parent | 1d641daf260308815d014d1bf1b424a1ed1e7277 (diff) | |
| download | bcm5719-llvm-2bdf33cc4c733342fc83081bc7410ac5e9a24f55.tar.gz bcm5719-llvm-2bdf33cc4c733342fc83081bc7410ac5e9a24f55.zip | |
[mlir] NFC: Remove Value::operator* and Value::operator-> now that Value is properly value-typed.
Summary: These were temporary methods used to simplify the transition.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D72548
Diffstat (limited to 'mlir/lib/Conversion')
10 files changed, 66 insertions, 67 deletions
diff --git a/mlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h b/mlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h index b75c1bf2d7b..fd5edf976ba 100644 --- a/mlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h +++ b/mlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h @@ -44,7 +44,7 @@ public: std::is_base_of<OpTrait::OneResult<SourceOp>, SourceOp>::value, "expected single result op"); - LLVMType resultType = lowering.convertType(op->getResult(0)->getType()) + LLVMType resultType = lowering.convertType(op->getResult(0).getType()) .template cast<LLVM::LLVMType>(); LLVMType funcType = getFunctionType(resultType, operands); StringRef funcName = getFunctionName(resultType); @@ -64,7 +64,7 @@ private: using LLVM::LLVMType; SmallVector<LLVMType, 1> operandTypes; for (Value operand : operands) { - operandTypes.push_back(operand->getType().cast<LLVMType>()); + operandTypes.push_back(operand.getType().cast<LLVMType>()); } return LLVMType::getFunctionTy(resultType, operandTypes, /*isVarArg=*/false); diff --git a/mlir/lib/Conversion/GPUToCUDA/ConvertLaunchFuncToCudaCalls.cpp b/mlir/lib/Conversion/GPUToCUDA/ConvertLaunchFuncToCudaCalls.cpp index 19dabcdafee..41f69d6e21d 100644 --- a/mlir/lib/Conversion/GPUToCUDA/ConvertLaunchFuncToCudaCalls.cpp +++ b/mlir/lib/Conversion/GPUToCUDA/ConvertLaunchFuncToCudaCalls.cpp @@ -253,7 +253,7 @@ Value GpuLaunchFuncToCudaCallsPass::setupParamsArray(gpu::LaunchFuncOp launchOp, arraySize, /*alignment=*/0); for (unsigned idx = 0; idx < numKernelOperands; ++idx) { auto operand = launchOp.getKernelOperand(idx); - auto llvmType = operand->getType().cast<LLVM::LLVMType>(); + auto llvmType = operand.getType().cast<LLVM::LLVMType>(); Value memLocation = builder.create<LLVM::AllocaOp>( loc, llvmType.getPointerTo(), one, /*alignment=*/1); builder.create<LLVM::StoreOp>(loc, operand, memLocation); diff --git a/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp b/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp index 08c18c1ec83..c2493f773d1 100644 --- a/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp +++ b/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp @@ -66,7 +66,7 @@ struct GPUAllReduceOpLowering : public LLVMOpLowering { Value operand = operands.front(); // TODO(csigg): Generalize to other types of accumulation. - assert(op->getOperand(0)->getType().isIntOrFloat()); + assert(op->getOperand(0).getType().isIntOrFloat()); // Create the reduction using an accumulator factory. AccumulatorFactory factory = @@ -87,7 +87,7 @@ private: return getFactory(allReduce.body()); } if (allReduce.op()) { - auto type = operand->getType().cast<LLVM::LLVMType>(); + auto type = operand.getType().cast<LLVM::LLVMType>(); return getFactory(*allReduce.op(), type.getUnderlyingType()); } return AccumulatorFactory(); @@ -127,7 +127,7 @@ private: // Return accumulator result. rewriter.setInsertionPointToStart(split); - return split->addArgument(lhs->getType()); + return split->addArgument(lhs.getType()); }); } @@ -154,7 +154,7 @@ private: template <typename T> AccumulatorFactory getFactory() const { return [](Location loc, Value lhs, Value rhs, ConversionPatternRewriter &rewriter) { - return rewriter.create<T>(loc, lhs->getType(), lhs, rhs); + return rewriter.create<T>(loc, lhs.getType(), lhs, rhs); }; } @@ -197,10 +197,10 @@ private: Value createBlockReduce(Location loc, Value operand, AccumulatorFactory &accumFactory, ConversionPatternRewriter &rewriter) const { - auto type = operand->getType().cast<LLVM::LLVMType>(); + auto type = operand.getType().cast<LLVM::LLVMType>(); // Create shared memory array to store the warp reduction. - auto module = operand->getDefiningOp()->getParentOfType<ModuleOp>(); + auto module = operand.getDefiningOp()->getParentOfType<ModuleOp>(); assert(module && "op must belong to a module"); Value sharedMemPtr = createSharedMemoryArray(loc, module, type, kWarpSize, rewriter); @@ -295,7 +295,7 @@ private: assert(thenOperands.size() == elseOperands.size()); rewriter.setInsertionPointToStart(continueBlock); for (auto operand : thenOperands) - continueBlock->addArgument(operand->getType()); + continueBlock->addArgument(operand.getType()); } /// Shortcut for createIf with empty else block and no block operands. @@ -321,7 +321,7 @@ private: loc, int32Type, rewriter.getI32IntegerAttr(kWarpSize)); Value isPartialWarp = rewriter.create<LLVM::ICmpOp>( loc, LLVM::ICmpPredicate::slt, activeWidth, warpSize); - auto type = operand->getType().cast<LLVM::LLVMType>(); + auto type = operand.getType().cast<LLVM::LLVMType>(); createIf( loc, rewriter, isPartialWarp, @@ -453,7 +453,7 @@ private: /// Returns value divided by the warp size (i.e. 32). Value getDivideByWarpSize(Value value, ConversionPatternRewriter &rewriter) const { - auto loc = value->getLoc(); + auto loc = value.getLoc(); auto warpSize = rewriter.create<LLVM::ConstantOp>( loc, int32Type, rewriter.getI32IntegerAttr(kWarpSize)); return rewriter.create<LLVM::SDivOp>(loc, int32Type, value, warpSize); @@ -492,7 +492,7 @@ struct GPUShuffleOpLowering : public LLVMOpLowering { gpu::ShuffleOpOperandAdaptor adaptor(operands); auto dialect = lowering.getDialect(); - auto valueTy = adaptor.value()->getType().cast<LLVM::LLVMType>(); + auto valueTy = adaptor.value().getType().cast<LLVM::LLVMType>(); auto int32Type = LLVM::LLVMType::getInt32Ty(dialect); auto predTy = LLVM::LLVMType::getInt1Ty(dialect); auto resultTy = LLVM::LLVMType::getStructTy(dialect, {valueTy, predTy}); @@ -540,7 +540,7 @@ struct GPUFuncOpLowering : LLVMOpLowering { for (auto en : llvm::enumerate(gpuFuncOp.getWorkgroupAttributions())) { Value attribution = en.value(); - auto type = attribution->getType().dyn_cast<MemRefType>(); + auto type = attribution.getType().dyn_cast<MemRefType>(); assert(type && type.hasStaticShape() && "unexpected type in attribution"); uint64_t numElements = type.getNumElements(); @@ -612,7 +612,7 @@ struct GPUFuncOpLowering : LLVMOpLowering { // otherwise necessary given that memref sizes are fixed, but we can try // and canonicalize that away later. Value attribution = gpuFuncOp.getWorkgroupAttributions()[en.index()]; - auto type = attribution->getType().cast<MemRefType>(); + auto type = attribution.getType().cast<MemRefType>(); auto descr = MemRefDescriptor::fromStaticShape(rewriter, loc, lowering, type, memory); signatureConversion.remapInput(numProperArguments + en.index(), descr); @@ -624,7 +624,7 @@ struct GPUFuncOpLowering : LLVMOpLowering { auto int64Ty = LLVM::LLVMType::getInt64Ty(lowering.getDialect()); for (auto en : llvm::enumerate(gpuFuncOp.getPrivateAttributions())) { Value attribution = en.value(); - auto type = attribution->getType().cast<MemRefType>(); + auto type = attribution.getType().cast<MemRefType>(); assert(type && type.hasStaticShape() && "unexpected type in attribution"); diff --git a/mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp b/mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp index 509457d076a..2fd8cedfd63 100644 --- a/mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp +++ b/mlir/lib/Conversion/GPUToSPIRV/ConvertGPUToSPIRV.cpp @@ -127,7 +127,7 @@ ForOpConversion::matchAndRewrite(loop::ForOp forOp, ArrayRef<Value> operands, // Create the new induction variable to use. BlockArgument newIndVar = - header->addArgument(forOperands.lowerBound()->getType()); + header->addArgument(forOperands.lowerBound().getType()); Block *body = forOp.getBody(); // Apply signature conversion to the body of the forOp. It has a single block, @@ -166,7 +166,7 @@ ForOpConversion::matchAndRewrite(loop::ForOp forOp, ArrayRef<Value> operands, // Add the step to the induction variable and branch to the header. Value updatedIndVar = rewriter.create<spirv::IAddOp>( - loc, newIndVar->getType(), newIndVar, forOperands.step()); + loc, newIndVar.getType(), newIndVar, forOperands.step()); rewriter.create<spirv::BranchOp>(loc, header, updatedIndVar); rewriter.eraseOp(forOp); diff --git a/mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp b/mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp index 86890b12ade..52549933f9d 100644 --- a/mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp +++ b/mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp @@ -152,7 +152,7 @@ public: ConversionPatternRewriter &rewriter) const override { auto rangeOp = cast<RangeOp>(op); auto rangeDescriptorTy = - convertLinalgType(rangeOp.getResult()->getType(), lowering); + convertLinalgType(rangeOp.getResult().getType(), lowering); edsc::ScopedContext context(rewriter, op->getLoc()); @@ -251,7 +251,7 @@ public: for (int i = 0, e = memRefType.getRank(); i < e; ++i) { Value indexing = adaptor.indexings()[i]; Value min = indexing; - if (sliceOp.indexing(i)->getType().isa<RangeType>()) + if (sliceOp.indexing(i).getType().isa<RangeType>()) min = extractvalue(int64Ty, indexing, pos(0)); baseOffset = add(baseOffset, mul(min, strides[i])); } @@ -274,7 +274,7 @@ public: int numNewDims = 0; for (auto en : llvm::enumerate(sliceOp.indexings())) { Value indexing = en.value(); - if (indexing->getType().isa<RangeType>()) { + if (indexing.getType().isa<RangeType>()) { int rank = en.index(); Value rangeDescriptor = adaptor.indexings()[rank]; Value min = extractvalue(int64Ty, rangeDescriptor, pos(0)); diff --git a/mlir/lib/Conversion/LoopsToGPU/LoopsToGPU.cpp b/mlir/lib/Conversion/LoopsToGPU/LoopsToGPU.cpp index 4dd703a2f0d..3ea1f85d62f 100644 --- a/mlir/lib/Conversion/LoopsToGPU/LoopsToGPU.cpp +++ b/mlir/lib/Conversion/LoopsToGPU/LoopsToGPU.cpp @@ -215,7 +215,7 @@ struct LoopToGpuConverter { // Return true if the value is obviously a constant "one". static bool isConstantOne(Value value) { - if (auto def = dyn_cast_or_null<ConstantIndexOp>(value->getDefiningOp())) + if (auto def = dyn_cast_or_null<ConstantIndexOp>(value.getDefiningOp())) return def.getValue() == 1; return false; } @@ -457,7 +457,7 @@ void LoopToGpuConverter::createLaunch(OpTy rootForOp, OpTy innermostForOp, Value ivReplacement = builder.create<AddIOp>(rootForOp.getLoc(), *lbArgumentIt, id); - en.value()->replaceAllUsesWith(ivReplacement); + en.value().replaceAllUsesWith(ivReplacement); replaceAllUsesInRegionWith(steps[en.index()], *stepArgumentIt, launchOp.body()); std::advance(lbArgumentIt, 1); diff --git a/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp b/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp index c456b00987d..0ea402792d6 100644 --- a/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp +++ b/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp @@ -249,7 +249,7 @@ LLVMOpLowering::LLVMOpLowering(StringRef rootOpName, MLIRContext *context, /*============================================================================*/ StructBuilder::StructBuilder(Value v) : value(v) { assert(value != nullptr && "value cannot be null"); - structType = value->getType().cast<LLVM::LLVMType>(); + structType = value.getType().cast<LLVM::LLVMType>(); } Value StructBuilder::extractPtr(OpBuilder &builder, Location loc, @@ -272,7 +272,7 @@ void StructBuilder::setPtr(OpBuilder &builder, Location loc, unsigned pos, MemRefDescriptor::MemRefDescriptor(Value descriptor) : StructBuilder(descriptor) { assert(value != nullptr && "value cannot be null"); - indexType = value->getType().cast<LLVM::LLVMType>().getStructElementType( + indexType = value.getType().cast<LLVM::LLVMType>().getStructElementType( kOffsetPosInMemRefDescriptor); } @@ -412,7 +412,7 @@ void MemRefDescriptor::setConstantStride(OpBuilder &builder, Location loc, } LLVM::LLVMType MemRefDescriptor::getElementType() { - return value->getType().cast<LLVM::LLVMType>().getStructElementType( + return value.getType().cast<LLVM::LLVMType>().getStructElementType( kAlignedPtrPosInMemRefDescriptor); } @@ -673,7 +673,7 @@ struct OneToOneLLVMOpLowering : public LLVMLegalizationPattern<SourceOp> { SmallVector<Value, 4> results; results.reserve(numResults); for (unsigned i = 0; i < numResults; ++i) { - auto type = this->lowering.convertType(op->getResult(i)->getType()); + auto type = this->lowering.convertType(op->getResult(i).getType()); results.push_back(rewriter.create<LLVM::ExtractValueOp>( op->getLoc(), type, newOp.getOperation()->getResult(0), rewriter.getI64ArrayAttr(i))); @@ -723,21 +723,21 @@ struct NaryOpLLVMOpLowering : public LLVMLegalizationPattern<SourceOp> { // Cannot convert ops if their operands are not of LLVM type. for (Value operand : operands) { - if (!operand || !operand->getType().isa<LLVM::LLVMType>()) + if (!operand || !operand.getType().isa<LLVM::LLVMType>()) return this->matchFailure(); } auto loc = op->getLoc(); - auto llvmArrayTy = operands[0]->getType().cast<LLVM::LLVMType>(); + auto llvmArrayTy = operands[0].getType().cast<LLVM::LLVMType>(); if (!llvmArrayTy.isArrayTy()) { auto newOp = rewriter.create<TargetOp>( - op->getLoc(), operands[0]->getType(), operands, op->getAttrs()); + op->getLoc(), operands[0].getType(), operands, op->getAttrs()); rewriter.replaceOp(op, newOp.getResult()); return this->matchSuccess(); } - auto vectorType = op->getResult(0)->getType().dyn_cast<VectorType>(); + auto vectorType = op->getResult(0).getType().dyn_cast<VectorType>(); if (!vectorType) return this->matchFailure(); auto vectorTypeInfo = extractNDVectorTypeInfo(vectorType, this->lowering); @@ -1032,7 +1032,7 @@ struct AllocOpLowering : public LLVMLegalizationPattern<AllocOp> { Value subbed = rewriter.create<LLVM::SubOp>(loc, alignmentValue, ptrModAlign); Value offset = rewriter.create<LLVM::URemOp>(loc, subbed, alignmentValue); - Value aligned = rewriter.create<LLVM::GEPOp>(loc, allocated->getType(), + Value aligned = rewriter.create<LLVM::GEPOp>(loc, allocated.getType(), allocated, offset); bitcastAligned = rewriter.create<LLVM::BitcastOp>( loc, elementPtrType, ArrayRef<Value>(aligned)); @@ -1132,7 +1132,7 @@ struct CallOpInterfaceLowering : public LLVMLegalizationPattern<CallOpType> { SmallVector<Value, 4> results; results.reserve(numResults); for (unsigned i = 0; i < numResults; ++i) { - auto type = this->lowering.convertType(op->getResult(i)->getType()); + auto type = this->lowering.convertType(op->getResult(i).getType()); results.push_back(rewriter.create<LLVM::ExtractValueOp>( op->getLoc(), type, newOp.getOperation()->getResult(0), rewriter.getI64ArrayAttr(i))); @@ -1207,7 +1207,7 @@ struct TanhOpLowering : public LLVMLegalizationPattern<TanhOp> { OperandAdaptor<TanhOp> transformed(operands); LLVMTypeT operandType = - transformed.operand()->getType().dyn_cast_or_null<LLVM::LLVMType>(); + transformed.operand().getType().dyn_cast_or_null<LLVM::LLVMType>(); if (!operandType) return matchFailure(); @@ -1249,12 +1249,12 @@ struct MemRefCastOpLowering : public LLVMLegalizationPattern<MemRefCastOp> { PatternMatchResult match(Operation *op) const override { auto memRefCastOp = cast<MemRefCastOp>(op); - Type srcType = memRefCastOp.getOperand()->getType(); + Type srcType = memRefCastOp.getOperand().getType(); Type dstType = memRefCastOp.getType(); if (srcType.isa<MemRefType>() && dstType.isa<MemRefType>()) { MemRefType sourceType = - memRefCastOp.getOperand()->getType().cast<MemRefType>(); + memRefCastOp.getOperand().getType().cast<MemRefType>(); MemRefType targetType = memRefCastOp.getType().cast<MemRefType>(); return (isSupportedMemRefType(targetType) && isSupportedMemRefType(sourceType)) @@ -1278,7 +1278,7 @@ struct MemRefCastOpLowering : public LLVMLegalizationPattern<MemRefCastOp> { auto memRefCastOp = cast<MemRefCastOp>(op); OperandAdaptor<MemRefCastOp> transformed(operands); - auto srcType = memRefCastOp.getOperand()->getType(); + auto srcType = memRefCastOp.getOperand().getType(); auto dstType = memRefCastOp.getType(); auto targetStructType = lowering.convertType(memRefCastOp.getType()); auto loc = op->getLoc(); @@ -1349,7 +1349,7 @@ struct DimOpLowering : public LLVMLegalizationPattern<DimOp> { ConversionPatternRewriter &rewriter) const override { auto dimOp = cast<DimOp>(op); OperandAdaptor<DimOp> transformed(operands); - MemRefType type = dimOp.getOperand()->getType().cast<MemRefType>(); + MemRefType type = dimOp.getOperand().getType().cast<MemRefType>(); auto shape = type.getShape(); int64_t index = dimOp.getIndex(); @@ -1529,9 +1529,9 @@ struct IndexCastOpLowering : public LLVMLegalizationPattern<IndexCastOp> { auto indexCastOp = cast<IndexCastOp>(op); auto targetType = - this->lowering.convertType(indexCastOp.getResult()->getType()) + this->lowering.convertType(indexCastOp.getResult().getType()) .cast<LLVM::LLVMType>(); - auto sourceType = transformed.in()->getType().cast<LLVM::LLVMType>(); + auto sourceType = transformed.in().getType().cast<LLVM::LLVMType>(); unsigned targetBits = targetType.getUnderlyingType()->getIntegerBitWidth(); unsigned sourceBits = sourceType.getUnderlyingType()->getIntegerBitWidth(); @@ -1564,7 +1564,7 @@ struct CmpIOpLowering : public LLVMLegalizationPattern<CmpIOp> { CmpIOpOperandAdaptor transformed(operands); rewriter.replaceOpWithNewOp<LLVM::ICmpOp>( - op, lowering.convertType(cmpiOp.getResult()->getType()), + op, lowering.convertType(cmpiOp.getResult().getType()), rewriter.getI64IntegerAttr(static_cast<int64_t>( convertCmpPredicate<LLVM::ICmpPredicate>(cmpiOp.getPredicate()))), transformed.lhs(), transformed.rhs()); @@ -1583,7 +1583,7 @@ struct CmpFOpLowering : public LLVMLegalizationPattern<CmpFOp> { CmpFOpOperandAdaptor transformed(operands); rewriter.replaceOpWithNewOp<LLVM::FCmpOp>( - op, lowering.convertType(cmpfOp.getResult()->getType()), + op, lowering.convertType(cmpfOp.getResult().getType()), rewriter.getI64IntegerAttr(static_cast<int64_t>( convertCmpPredicate<LLVM::FCmpPredicate>(cmpfOp.getPredicate()))), transformed.lhs(), transformed.rhs()); @@ -1807,7 +1807,7 @@ struct SubViewOpLowering : public LLVMLegalizationPattern<SubViewOp> { 1 + viewOp.getNumOffsets() + viewOp.getNumSizes()), operands.end()); - auto sourceMemRefType = viewOp.source()->getType().cast<MemRefType>(); + auto sourceMemRefType = viewOp.source().getType().cast<MemRefType>(); auto sourceElementTy = lowering.convertType(sourceMemRefType.getElementType()) .dyn_cast_or_null<LLVM::LLVMType>(); @@ -2174,7 +2174,7 @@ Value LLVMTypeConverter::promoteOneMemRefDescriptor(Location loc, Value operand, auto indexType = IndexType::get(context); // Alloca with proper alignment. We do not expect optimizations of this // alloca op and so we omit allocating at the entry block. - auto ptrType = operand->getType().cast<LLVM::LLVMType>().getPointerTo(); + auto ptrType = operand.getType().cast<LLVM::LLVMType>().getPointerTo(); Value one = builder.create<LLVM::ConstantOp>(loc, int64Ty, IntegerAttr::get(indexType, 1)); Value allocated = @@ -2193,8 +2193,8 @@ LLVMTypeConverter::promoteMemRefDescriptors(Location loc, ValueRange opOperands, for (auto it : llvm::zip(opOperands, operands)) { auto operand = std::get<0>(it); auto llvmOperand = std::get<1>(it); - if (!operand->getType().isa<MemRefType>() && - !operand->getType().isa<UnrankedMemRefType>()) { + if (!operand.getType().isa<MemRefType>() && + !operand.getType().isa<UnrankedMemRefType>()) { promotedOperands.push_back(operand); continue; } diff --git a/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp b/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp index 10533a4eed2..7e7b7ef6ea6 100644 --- a/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp +++ b/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRV.cpp @@ -74,7 +74,7 @@ public: matchAndRewrite(StdOp operation, ArrayRef<Value> operands, ConversionPatternRewriter &rewriter) const override { auto resultType = - this->typeConverter.convertType(operation.getResult()->getType()); + this->typeConverter.convertType(operation.getResult().getType()); rewriter.template replaceOpWithNewOp<SPIRVOp>( operation, resultType, operands, ArrayRef<NamedAttribute>()); return this->matchSuccess(); @@ -178,7 +178,7 @@ spirv::AccessChainOp getElementPtr(OpBuilder &builder, PatternMatchResult ConstantIndexOpConversion::matchAndRewrite( ConstantOp constIndexOp, ArrayRef<Value> operands, ConversionPatternRewriter &rewriter) const { - if (!constIndexOp.getResult()->getType().isa<IndexType>()) { + if (!constIndexOp.getResult().getType().isa<IndexType>()) { return matchFailure(); } // The attribute has index type which is not directly supported in @@ -197,7 +197,7 @@ PatternMatchResult ConstantIndexOpConversion::matchAndRewrite( return matchFailure(); } auto spirvConstType = - typeConverter.convertType(constIndexOp.getResult()->getType()); + typeConverter.convertType(constIndexOp.getResult().getType()); auto spirvConstVal = rewriter.getIntegerAttr(spirvConstType, constAttr.getInt()); rewriter.replaceOpWithNewOp<spirv::ConstantOp>(constIndexOp, spirvConstType, @@ -217,9 +217,9 @@ CmpFOpConversion::matchAndRewrite(CmpFOp cmpFOp, ArrayRef<Value> operands, switch (cmpFOp.getPredicate()) { #define DISPATCH(cmpPredicate, spirvOp) \ case cmpPredicate: \ - rewriter.replaceOpWithNewOp<spirvOp>( \ - cmpFOp, cmpFOp.getResult()->getType(), cmpFOpOperands.lhs(), \ - cmpFOpOperands.rhs()); \ + rewriter.replaceOpWithNewOp<spirvOp>(cmpFOp, cmpFOp.getResult().getType(), \ + cmpFOpOperands.lhs(), \ + cmpFOpOperands.rhs()); \ return matchSuccess(); // Ordered. @@ -257,9 +257,9 @@ CmpIOpConversion::matchAndRewrite(CmpIOp cmpIOp, ArrayRef<Value> operands, switch (cmpIOp.getPredicate()) { #define DISPATCH(cmpPredicate, spirvOp) \ case cmpPredicate: \ - rewriter.replaceOpWithNewOp<spirvOp>( \ - cmpIOp, cmpIOp.getResult()->getType(), cmpIOpOperands.lhs(), \ - cmpIOpOperands.rhs()); \ + rewriter.replaceOpWithNewOp<spirvOp>(cmpIOp, cmpIOp.getResult().getType(), \ + cmpIOpOperands.lhs(), \ + cmpIOpOperands.rhs()); \ return matchSuccess(); DISPATCH(CmpIPredicate::eq, spirv::IEqualOp); @@ -287,7 +287,7 @@ LoadOpConversion::matchAndRewrite(LoadOp loadOp, ArrayRef<Value> operands, ConversionPatternRewriter &rewriter) const { LoadOpOperandAdaptor loadOperands(operands); auto loadPtr = getElementPtr(rewriter, typeConverter, loadOp.getLoc(), - loadOp.memref()->getType().cast<MemRefType>(), + loadOp.memref().getType().cast<MemRefType>(), loadOperands.memref(), loadOperands.indices()); rewriter.replaceOpWithNewOp<spirv::LoadOp>(loadOp, loadPtr, /*memory_access =*/nullptr, @@ -333,7 +333,7 @@ StoreOpConversion::matchAndRewrite(StoreOp storeOp, ArrayRef<Value> operands, StoreOpOperandAdaptor storeOperands(operands); auto storePtr = getElementPtr(rewriter, typeConverter, storeOp.getLoc(), - storeOp.memref()->getType().cast<MemRefType>(), + storeOp.memref().getType().cast<MemRefType>(), storeOperands.memref(), storeOperands.indices()); rewriter.replaceOpWithNewOp<spirv::StoreOp>(storeOp, storePtr, storeOperands.value(), diff --git a/mlir/lib/Conversion/StandardToSPIRV/LegalizeStandardForSPIRV.cpp b/mlir/lib/Conversion/StandardToSPIRV/LegalizeStandardForSPIRV.cpp index a658356f76c..22705b7d1ff 100644 --- a/mlir/lib/Conversion/StandardToSPIRV/LegalizeStandardForSPIRV.cpp +++ b/mlir/lib/Conversion/StandardToSPIRV/LegalizeStandardForSPIRV.cpp @@ -110,8 +110,7 @@ resolveSourceIndices(Location loc, PatternRewriter &rewriter, PatternMatchResult LoadOpOfSubViewFolder::matchAndRewrite(LoadOp loadOp, PatternRewriter &rewriter) const { - auto subViewOp = - dyn_cast_or_null<SubViewOp>(loadOp.memref()->getDefiningOp()); + auto subViewOp = dyn_cast_or_null<SubViewOp>(loadOp.memref().getDefiningOp()); if (!subViewOp) { return matchFailure(); } @@ -133,7 +132,7 @@ PatternMatchResult StoreOpOfSubViewFolder::matchAndRewrite(StoreOp storeOp, PatternRewriter &rewriter) const { auto subViewOp = - dyn_cast_or_null<SubViewOp>(storeOp.memref()->getDefiningOp()); + dyn_cast_or_null<SubViewOp>(storeOp.memref().getDefiningOp()); if (!subViewOp) { return matchFailure(); } diff --git a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp index 1fbee9742e0..cc6636df00e 100644 --- a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp +++ b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp @@ -368,7 +368,7 @@ public: auto adaptor = vector::ExtractOpOperandAdaptor(operands); auto extractOp = cast<vector::ExtractOp>(op); auto vectorType = extractOp.getVectorType(); - auto resultType = extractOp.getResult()->getType(); + auto resultType = extractOp.getResult().getType(); auto llvmResultType = lowering.convertType(resultType); auto positionArrayAttr = extractOp.position(); @@ -647,12 +647,12 @@ public: auto loc = op->getLoc(); auto adaptor = vector::OuterProductOpOperandAdaptor(operands); auto *ctx = op->getContext(); - auto vLHS = adaptor.lhs()->getType().cast<LLVM::LLVMType>(); - auto vRHS = adaptor.rhs()->getType().cast<LLVM::LLVMType>(); + auto vLHS = adaptor.lhs().getType().cast<LLVM::LLVMType>(); + auto vRHS = adaptor.rhs().getType().cast<LLVM::LLVMType>(); auto rankLHS = vLHS.getUnderlyingType()->getVectorNumElements(); auto rankRHS = vRHS.getUnderlyingType()->getVectorNumElements(); auto llvmArrayOfVectType = lowering.convertType( - cast<vector::OuterProductOp>(op).getResult()->getType()); + cast<vector::OuterProductOp>(op).getResult().getType()); Value desc = rewriter.create<LLVM::UndefOp>(loc, llvmArrayOfVectType); Value a = adaptor.lhs(), b = adaptor.rhs(); Value acc = adaptor.acc().empty() ? nullptr : adaptor.acc().front(); @@ -699,9 +699,9 @@ public: auto loc = op->getLoc(); vector::TypeCastOp castOp = cast<vector::TypeCastOp>(op); MemRefType sourceMemRefType = - castOp.getOperand()->getType().cast<MemRefType>(); + castOp.getOperand().getType().cast<MemRefType>(); MemRefType targetMemRefType = - castOp.getResult()->getType().cast<MemRefType>(); + castOp.getResult().getType().cast<MemRefType>(); // Only static shape casts supported atm. if (!sourceMemRefType.hasStaticShape() || @@ -709,7 +709,7 @@ public: return matchFailure(); auto llvmSourceDescriptorTy = - operands[0]->getType().dyn_cast<LLVM::LLVMType>(); + operands[0].getType().dyn_cast<LLVM::LLVMType>(); if (!llvmSourceDescriptorTy || !llvmSourceDescriptorTy.isStructTy()) return matchFailure(); MemRefDescriptor sourceMemRef(operands[0]); |

