This is an archive of the discontinued LLVM Phabricator instance.

[flang] Don't convert actual argument if IGNORE_TKR is present for the corresponding dummy.
ClosedPublic

Authored by DanielCChen on May 24 2023, 8:26 PM.

Details

Summary

Consider the following code:

interface
integer(4) function foo4(arg1, arg2)
integer :: arg1
integer(4) :: arg2
!dir$ ignore_tkr(k) arg1
end
end interface

integer(4) :: res, a
integer(2) :: b
res = foo4(b, a)
end

Flang currently converts arg1 from i16 to i32 when lowering.

%3 = fir.convert %1 : (!fir.ref<i16>) -> !fir.ref<i32>
This PR is to remove the conversion.

Diff Detail

Event Timeline

DanielCChen created this revision.May 24 2023, 8:26 PM
Herald added a project: Restricted Project. · View Herald Transcript
DanielCChen requested review of this revision.May 24 2023, 8:26 PM
klausler added inline comments.May 25 2023, 7:45 AM
flang/lib/Semantics/check-call.cpp
223

I think you want to only be affected here by the first two parts of the typesCompatible conjunction, which depend on IgnoreTKR, but not the last one. So you'll have to split typesCompatible, with a new Boolean indicating whether IgnoreTKR was applied, and then use that new Boolean in your new &= !....

To address review comments. Separating typeCompatible into two Booleans.

klausler accepted this revision.May 25 2023, 8:08 AM

Looks great. Thanks for digging into this!

This revision is now accepted and ready to land.May 25 2023, 8:08 AM

Sorry that the patch file was accidentally added to the review. This revision is to remove it.