Skip to content

Fix remaining build failures with GCC 8.3 #83266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions mlir/include/mlir/IR/ValueRange.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ class MutableOperandRange {
/// Returns if the current range is empty.
bool empty() const { return size() == 0; }

/// Explicit conversion to an OperandRange.
OperandRange getAsOperandRange() const;

/// Allow implicit conversion to an OperandRange.
operator OperandRange() const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -956,13 +956,13 @@ BufferDeallocation::handleInterface(RegionBranchTerminatorOpInterface op) {

SmallVector<Value> updatedOwnerships;
auto result = deallocation_impl::insertDeallocOpForReturnLike(
state, op, OperandRange(operands), updatedOwnerships);
state, op, operands.getAsOperandRange(), updatedOwnerships);
if (failed(result) || !*result)
return result;

// Add an additional operand for every MemRef for the ownership indicator.
if (!funcWithoutDynamicOwnership) {
SmallVector<Value> newOperands{OperandRange(operands)};
SmallVector<Value> newOperands{operands.getAsOperandRange()};
newOperands.append(updatedOwnerships.begin(), updatedOwnerships.end());
operands.assign(newOperands);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct CondBranchOpInterface
DenseMap<Value, Value> &mapping) -> DeallocOp {
SmallVector<Value> toRetain;
state.getMemrefsToRetain(condBr->getBlock(), target,
OperandRange(destOperands), toRetain);
destOperands.getAsOperandRange(), toRetain);
SmallVector<Value> adaptedConditions(
llvm::map_range(conditions, conditionModifier));
auto deallocOp = builder.create<bufferization::DeallocOp>(
Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ static LinalgOp fuse(OpBuilder &b, LinalgOp producer,
SmallVector<Type, 4> resultTypes;
resultTypes.reserve(producer->getNumResults());
int64_t firstInitOperandIdx =
static_cast<OperandRange>(producerDpsInits).getBeginOperandIndex();
producerDpsInits.getAsOperandRange().getBeginOperandIndex();
for (int64_t i = 0, e = producer->getNumResults(); i < e; ++i) {
resultTypes.push_back(clonedShapes[firstInitOperandIdx + i].getType());
}
Expand Down
7 changes: 6 additions & 1 deletion mlir/lib/IR/OperationSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,14 @@ void MutableOperandRange::clear() {
}
}

/// Explicit conversion to an OperandRange.
OperandRange MutableOperandRange::getAsOperandRange() const {
return owner->getOperands().slice(start, length);
}

/// Allow implicit conversion to an OperandRange.
MutableOperandRange::operator OperandRange() const {
return owner->getOperands().slice(start, length);
return getAsOperandRange();
}

MutableOperandRange::operator MutableArrayRef<OpOperand>() const {
Expand Down
3 changes: 1 addition & 2 deletions mlir/lib/Transforms/Utils/CFGToSCF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1183,8 +1183,7 @@ static FailureOr<SmallVector<Block *>> transformToStructuredCFBranches(
auto builder = OpBuilder::atBlockTerminator(user->getBlock());
LogicalResult result = interface.createStructuredBranchRegionTerminatorOp(
user->getLoc(), builder, structuredCondOp, user,
static_cast<OperandRange>(
getMutableSuccessorOperands(user->getBlock(), 0)));
getMutableSuccessorOperands(user->getBlock(), 0).getAsOperandRange());
if (failed(result))
return failure();
user->erase();
Expand Down