Skip to content

Commit f3e8cbe

Browse files
Make changes based on review comments
1 parent ada55c9 commit f3e8cbe

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

flang/include/flang/Optimizer/Dialect/FIRType.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,8 @@ inline mlir::Type unwrapRefType(mlir::Type t) {
278278
/// If `t` conforms with a pass-by-reference type (box, ref, ptr, etc.) then
279279
/// return the element type of `t`. Otherwise, return `t`.
280280
inline mlir::Type unwrapPassByRefType(mlir::Type t) {
281-
if (conformsWithPassByRef(t))
282-
if (auto eleTy = dyn_cast_ptrOrBoxEleTy(t))
283-
return eleTy;
281+
if (auto eleTy = dyn_cast_ptrOrBoxEleTy(t))
282+
return eleTy;
284283
return t;
285284
}
286285

flang/lib/Optimizer/Dialect/FIROps.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4485,21 +4485,19 @@ llvm::LogicalResult fir::BoxOffsetOp::verify() {
44854485
auto boxType = mlir::dyn_cast_or_null<fir::BaseBoxType>(
44864486
fir::dyn_cast_ptrEleTy(getBoxRef().getType()));
44874487
mlir::Type boxCharType;
4488-
bool isBoxChar = false;
44894488
if (!boxType) {
44904489
boxCharType = mlir::dyn_cast_or_null<fir::BoxCharType>(
44914490
fir::dyn_cast_ptrEleTy(getBoxRef().getType()));
44924491
if (!boxCharType)
44934492
return emitOpError("box_ref operand must have !fir.ref<!fir.box<T>> or "
44944493
"!fir.ref<!fir.boxchar<k>> type");
4495-
isBoxChar = true;
4494+
if (getField() == fir::BoxFieldAttr::derived_type)
4495+
return emitOpError("cannot address derived_type field of a fir.boxchar");
44964496
}
44974497
if (getField() != fir::BoxFieldAttr::base_addr &&
44984498
getField() != fir::BoxFieldAttr::derived_type)
44994499
return emitOpError("cannot address provided field");
45004500
if (getField() == fir::BoxFieldAttr::derived_type) {
4501-
if (isBoxChar)
4502-
return emitOpError("cannot address derived_type field of a fir.boxchar");
45034501
if (!fir::boxHasAddendum(boxType))
45044502
return emitOpError("can only address derived_type field of derived type "
45054503
"or unlimited polymorphic fir.box");

0 commit comments

Comments
 (0)