Skip to content
Merged
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
12 changes: 1 addition & 11 deletions flang/lib/Lower/ConvertVariable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,17 +392,7 @@ static mlir::Value createNewLocal(Fortran::lower::AbstractConverter &converter,
const auto &ultimateSymbol = var.getSymbol().GetUltimate();
auto symNm = toStringRef(ultimateSymbol.name());
auto isTarg = var.isTarget();
if (shape.size())
if (auto arrTy = ty.dyn_cast<fir::SequenceType>()) {
// elide the constant dimensions before construction
assert(shape.size() == arrTy.getDimension());
llvm::SmallVector<mlir::Value> args;
auto typeShape = arrTy.getShape();
for (unsigned i = 0, end = arrTy.getDimension(); i < end; ++i)
if (typeShape[i] == fir::SequenceType::getUnknownExtent())
args.push_back(shape[i]);
return builder.allocateLocal(loc, ty, nm, symNm, args, lenParams, isTarg);
}
// Let the builder do all the heavy lifting.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment might be unnecessary / confusing?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. On the other hand, I sort of wanted to indicate "don't overthink this here, this function is just a thin veneer over the real thing."

return builder.allocateLocal(loc, ty, nm, symNm, shape, lenParams, isTarg);
}

Expand Down