Skip to content

Commit a437a8d

Browse files
committed
Prevent fir.convert operation from being generated between logical and pointer types
1 parent 3cd3570 commit a437a8d

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

flang/lib/Lower/ConvertCall.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,6 @@ static bool mustCastFuncOpToCopeWithImplicitInterfaceMismatch(
151151
if (actualType != dummyType &&
152152
!fir::ConvertOp::canBeConverted(actualType, dummyType))
153153
return true;
154-
155-
// For %VAL arguments with implicit interfaces, we need to force an indirect
156-
// call to ensure consistent behavior regardless of whether the procedure
157-
// is defined in the same compilation unit or not. Check for mismatches
158-
// where a by-value call site expects a reference type in the actual
159-
// function definition.
160-
for (auto [actualType, dummyType] :
161-
llvm::zip(callSiteType.getInputs(), funcOpType.getInputs()))
162-
if (!fir::isa_ref_type(actualType) && fir::isa_ref_type(dummyType) &&
163-
fir::dyn_cast_ptrEleTy(dummyType) == actualType)
164-
return true;
165154
return false;
166155
}
167156

flang/lib/Optimizer/Dialect/FIROps.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,8 +1521,8 @@ bool fir::ConvertOp::canBeConverted(mlir::Type inType, mlir::Type outType) {
15211521
(isInteger(inType) && isFloatCompatible(outType)) ||
15221522
(isFloatCompatible(inType) && isInteger(outType)) ||
15231523
(isFloatCompatible(inType) && isFloatCompatible(outType)) ||
1524-
(isIntegerCompatible(inType) && isPointerCompatible(outType)) ||
1525-
(isPointerCompatible(inType) && isIntegerCompatible(outType)) ||
1524+
(isInteger(inType) && isPointerCompatible(outType)) ||
1525+
(isPointerCompatible(inType) && isInteger(outType)) ||
15261526
(mlir::isa<fir::BoxType>(inType) &&
15271527
mlir::isa<fir::BoxType>(outType)) ||
15281528
(mlir::isa<fir::BoxProcType>(inType) &&

0 commit comments

Comments
 (0)