This is an archive of the discontinued LLVM Phabricator instance.

[flang] Adding options to the CfgConversion pass
AbandonedPublic

Authored by Renaud-K on Feb 4 2022, 11:09 AM.

Details

Summary

Adding options to the CfgConversion pass to selectively convert fir.do_loop, fir.if and and fir.iter_while

Diff Detail

Event Timeline

Renaud-K requested review of this revision.Feb 4 2022, 11:09 AM
Renaud-K created this revision.
clementval accepted this revision.Feb 4 2022, 12:40 PM

LGTM. Looks like pre-check are failing

This revision is now accepted and ready to land.Feb 4 2022, 12:40 PM
Renaud-K updated this revision to Diff 406116.Feb 4 2022, 3:20 PM

Added split-file as a tool. Seems, it was necessary for the pre-check tests.

mehdi_amini added inline comments.Feb 4 2022, 4:06 PM
flang/test/Fir/cfg-options.fir
6 ↗(On Diff #406116)

Isn't it a bit more maintainable to have separate files instead?

They'll show as separate failure if any is failing, it is easier to reproduce issues, and in general long files are annoying to work with.

Renaud-K updated this revision to Diff 406154.Feb 4 2022, 9:50 PM

Split tests into 4 files. Just can't figure how to get split-file to work with the pre-check tests.
Added constructor with options to CfgConversion

Instead of options1, options2, options3, ... can you name them more into what they are testing? Like cfg_conversion_no_while.fir, cfg_conversion_no_while_no_if.fir, ...

Also if the source if purely identical, instead of duplicating in different files, you can have multiple FileCheck prefixes, see for example: flang/test/Fir/convert-to-llvm-target.fir

Renaud-K updated this revision to Diff 406160.Feb 4 2022, 10:51 PM
Renaud-K marked an inline comment as done.

I had mistakenly removed lit.cfg.py instead of undoing the changes in it.

Renaud-K updated this revision to Diff 406495.Feb 7 2022, 9:20 AM

Renamed test files.

Renaud-K abandoned this revision.Feb 10 2022, 5:47 PM

I am not going to submit this patch as I have found out that it is not legal FIR to have branch based CFG operations inside of block based CFG operations (fir.do_loop, fir.if and fir.iterate_while)

flang/test/Fir/cfg-options.fir
6 ↗(On Diff #406116)

All this does is testing the plumbing of a few options so it seemed a bit over the top to have 4 different tests. But I guess this is moot since I cannot get split-file to work with pre-check build. I may try again at a later time and add reviewers only once I know it works to avoid the noise.