This is an archive of the discontinued LLVM Phabricator instance.

[flang] Fold the RHS of assignment
ClosedPublic

Authored by klausler on Dec 1 2022, 3:27 PM.

Details

Summary

In order to emit overflow warnings from assignment statements whose
right-hand sides are constants that undergo conversions, run the
right-hand sides of assignments through constant folding after the
conversions have been made explicit in expression analysis.

Diff Detail

Event Timeline

klausler created this revision.Dec 1 2022, 3:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 1 2022, 3:27 PM
Herald added a subscriber: jdoerfert. · View Herald Transcript
klausler requested review of this revision.Dec 1 2022, 3:27 PM
jeanPerier added inline comments.Dec 2 2022, 12:15 AM
flang/test/Lower/array-temp.f90
121–123

Regression test are failing. This is because the test update is now testing for something that is environment dependent: the path name of the current file.

You will need to remove the checks from: ! CHECK: %[[V_47:[0-9]+]] = fir.address_of ... to %[[V_49:[0-9]+]] ... and replace that last one by:
%[[V_49:[0-9]+]] = fir.call @_FortranAioBeginExternalListOutput(%[[C_m1_i32]]], %{{.*}}, %{{.*}}) {{.*}}: (i32, !fir.ref<i8>, i32) -> !fir.ref<i8>

You will need to do the same for all _FortranAioBeginExternalListOutput calls (in general, this needs to be done on every runtime call that takes the file name as argument).

This test is in general checking for way too much... sorry about the trouble this is causing you. New lowering test should be more focus on what they are testing.

klausler updated this revision to Diff 479941.Dec 4 2022, 12:26 PM

Update expected test results per Jean's comment.

jeanPerier accepted this revision.Dec 5 2022, 12:04 AM
This revision is now accepted and ready to land.Dec 5 2022, 12:04 AM
This revision was automatically updated to reflect the committed changes.