diff --git a/build_tools/llvm_version.txt b/build_tools/llvm_version.txt index d83e104..25a6042 100644 --- a/build_tools/llvm_version.txt +++ b/build_tools/llvm_version.txt @@ -1,2 +1,2 @@ -5ffd940ac02a8e000691c45a6dc4f69d0198e675 +202766947edb5407b84484185608aac077085608 diff --git a/lib/Dialect/mhlo/IR/hlo_ops.cc b/lib/Dialect/mhlo/IR/hlo_ops.cc index 4f3d593..e5f09c1 100644 --- a/lib/Dialect/mhlo/IR/hlo_ops.cc +++ b/lib/Dialect/mhlo/IR/hlo_ops.cc @@ -172,7 +172,7 @@ static LogicalResult Verify(DotGeneralOp op) { /// Fold get_dimension_size when the said shape dimension is a constant. OpFoldResult GetDimensionSizeOp::fold(ArrayRef attrs) { RankedTensorType type = operand().getType().cast(); - int32_t dim = dimension().getSExtValue(); + int32_t dim = dimension(); if (type.isDynamic(dim)) return {}; // The result type is always is a 0-d i32 tensor. return DenseIntElementsAttr::get( @@ -190,7 +190,7 @@ static LogicalResult Verify(IotaOp op) { if (shape.getRank() == 0) return op.emitOpError() << "does not support scalars."; - auto iota_dimension = op.iota_dimension().getSExtValue(); + auto iota_dimension = op.iota_dimension(); if (iota_dimension >= shape.getRank() || iota_dimension < 0) return op.emitOpError() << "iota dimension cannot go beyond the output " "rank or be negative."; @@ -212,8 +212,7 @@ struct IotaBroadcast : public OpRewritePattern { auto iota_dimension = iota.iota_dimension(); auto iota_type = RankedTensorType::get( - {result_ty.getDimSize(iota_dimension.getLimitedValue())}, - result_ty.getElementType()); + {result_ty.getDimSize(iota_dimension)}, result_ty.getElementType()); auto new_iota = rewriter.create(iota.getLoc(), iota_type, rewriter.getI64IntegerAttr(0)); @@ -233,7 +232,7 @@ void IotaOp::getCanonicalizationPatterns(OwningRewritePatternList& results, } OpFoldResult IotaOp::fold(ArrayRef operands) { - auto dimension = iota_dimension().getLimitedValue(); + auto dimension = iota_dimension(); auto result_ty = getResult().getType().cast(); if (result_ty.hasRank() && result_ty.getDimSize(dimension) == 1) { Builder builder(getContext()); @@ -277,7 +276,7 @@ struct DynamicIotaBroadcast : public OpRewritePattern { } auto iota_dimension = iota.iota_dimension(); - auto iota_dimension_int = iota_dimension.getLimitedValue(); + auto iota_dimension_int = iota_dimension; auto converted_shape = rewriter.create( iota.getLoc(), @@ -476,7 +475,7 @@ static LogicalResult Verify(DequantizeOp op) { //===----------------------------------------------------------------------===// static LogicalResult Verify(GetTupleElementOp op) { - auto indexVal = op.index().getZExtValue(); + auto indexVal = op.index(); auto operandType = op.getOperand().getType().cast(); if (indexVal >= operandType.size()) { return op.emitOpError( @@ -495,7 +494,7 @@ static LogicalResult Verify(GetTupleElementOp op) { OpFoldResult GetTupleElementOp::fold(ArrayRef operands) { if (auto tupleOp = dyn_cast_or_null(getOperand().getDefiningOp())) { - return tupleOp.getOperand(index().getLimitedValue()); + return tupleOp.getOperand(index()); } return {}; @@ -565,8 +564,8 @@ static LogicalResult Verify(AllToAllOp op) { // count. auto type = op.getOperand().getType().dyn_cast(); if (!type) return success(); - auto split_dim_size = type.getDimSize(op.split_dimension().getSExtValue()); - auto split_count = op.split_count().getSExtValue(); + auto split_dim_size = type.getDimSize(op.split_dimension()); + auto split_count = op.split_count(); if (split_dim_size % split_count != 0) { return op.emitError() << "split dimension has size " << split_dim_size << ", expected to be a multiple of split_count " @@ -914,7 +913,7 @@ class ConcatenateOperandRemoval : public OpRewritePattern { using OpRewritePattern::OpRewritePattern; LogicalResult matchAndRewrite(ConcatenateOp op, PatternRewriter& rewriter) const override { - auto axis = op.dimension().getLimitedValue(); + auto axis = op.dimension(); llvm::SmallVector new_operands; for (auto operand : op.getOperands()) { auto ty = operand.getType().cast(); @@ -994,7 +993,7 @@ void ConcatenateOp::getCanonicalizationPatterns( template static Attribute foldConcatenateHelper(ConcatenateOp* op, ArrayRef operands) { - auto axis = op->dimension().getLimitedValue(); + auto axis = op->dimension(); auto type = op->getType().cast(); SmallVector values; @@ -1042,7 +1041,7 @@ OpFoldResult ConcatenateOp::fold(ArrayRef operands) { ShapedType type = getResult().getType().cast(); if (!type.hasStaticShape()) return {}; - auto axis = dimension().getLimitedValue(); + auto axis = dimension(); if (auto attr = foldConcatenate(this, operands)) { return attr; } @@ -1845,7 +1844,7 @@ struct SimplifyConcatSlice : public OpRewritePattern { return failure(); } - auto dimension = concat.dimension().getSExtValue(); + auto dimension = concat.dimension(); auto start = slice.start_indices().getIntValues(); auto limit = slice.limit_indices().getIntValues(); @@ -1995,7 +1994,7 @@ static LogicalResult Verify(SortOp op) { return op.emitOpError("requires all inputs to have the same dimensions"); int64_t rank = input_shape.size(); - int64_t cmp_dim = op.dimension().getSExtValue(); + int64_t cmp_dim = op.dimension(); if (cmp_dim < -rank || cmp_dim >= rank) return op.emitOpError("dimension attribute value must be in range [-") << rank << ", " << rank << "), but found " << cmp_dim; diff --git a/lib/Dialect/mhlo/transforms/legalize_to_linalg.cc b/lib/Dialect/mhlo/transforms/legalize_to_linalg.cc index 566ef95..dd98fb4 100644 --- a/lib/Dialect/mhlo/transforms/legalize_to_linalg.cc +++ b/lib/Dialect/mhlo/transforms/legalize_to_linalg.cc @@ -704,7 +704,7 @@ class IotaConverter : public OpConversionPattern { [&](OpBuilder& nestedBuilder, Location nestedLoc, ValueRange ivs, ValueRange args) { Value castOp = nestedBuilder.create( - nestedLoc, ivs[iotaOp.iota_dimension().getZExtValue()], + nestedLoc, ivs[iotaOp.iota_dimension()], nestedBuilder.getIntegerType( resultElementType.getIntOrFloatBitWidth())); if (resultElementType.template isa()) { diff --git a/lib/Dialect/mhlo/transforms/legalize_to_standard.cc b/lib/Dialect/mhlo/transforms/legalize_to_standard.cc index 5000fce..d2d4bab 100644 --- a/lib/Dialect/mhlo/transforms/legalize_to_standard.cc +++ b/lib/Dialect/mhlo/transforms/legalize_to_standard.cc @@ -117,7 +117,7 @@ class ConvertIotaOp : public OpRewritePattern { PatternRewriter &rewriter) const override { auto output_type = op.getType().cast(); auto output_size = output_type.getNumElements(); - auto dimension = op.iota_dimension().getSExtValue(); + auto dimension = op.iota_dimension(); auto max_dim_size = output_type.getDimSize(dimension); auto element_type = output_type.getElementType(); diff --git a/lib/Dialect/mhlo/transforms/mhlo_control_flow_to_scf.cc b/lib/Dialect/mhlo/transforms/mhlo_control_flow_to_scf.cc index aba7b07..dba3cab 100644 --- a/lib/Dialect/mhlo/transforms/mhlo_control_flow_to_scf.cc +++ b/lib/Dialect/mhlo/transforms/mhlo_control_flow_to_scf.cc @@ -80,7 +80,7 @@ void MatchAndRewrite(WhileOp whileOp) { // the external value is captured. if (auto gte = val.getDefiningOp()) { if (!gte.getOperand().isa()) return {nullptr, 0}; - int index = gte.index().getSExtValue(); + int index = gte.index(); return {tupleOp.getOperand(index), index}; } return {nullptr, 0}; @@ -154,7 +154,7 @@ void MatchAndRewrite(WhileOp whileOp) { use->erase(); continue; } - int index = gte.index().getSExtValue(); + int index = gte.index(); // If after the loop induction variable, then decrement as we don't include // the loop induction variable in the for iter operands. if (index > loopIndVar.second) --index; diff --git a/lib/Dialect/mhlo/transforms/unfuse_batch_norm.cc b/lib/Dialect/mhlo/transforms/unfuse_batch_norm.cc index 1458e5f..9d07248 100644 --- a/lib/Dialect/mhlo/transforms/unfuse_batch_norm.cc +++ b/lib/Dialect/mhlo/transforms/unfuse_batch_norm.cc @@ -122,7 +122,7 @@ class UnfuseBatchNormInferencePattern if (!fp_type) { return failure(); } - int64_t feature_dim = bn_op.feature_index().getSExtValue(); + int64_t feature_dim = bn_op.feature_index(); // Add epsilon to the variance and sqrt to get stddev: // stddev = sqrt(variance + epsilon)