This is an archive of the discontinued LLVM Phabricator instance.

Simplify the CFG after loop pass cleanup.
ClosedPublic

Authored by filcab on Feb 28 2017, 11:38 AM.

Details

Summary

Otherwise we might end up with some empty basic blocks or
single-entry-single-exit basic blocks.

This fixes PR32085

Diff Detail

Repository
rL LLVM

Event Timeline

filcab created this revision.Feb 28 2017, 11:38 AM
filcab updated this revision to Diff 90070.Feb 28 2017, 11:59 AM

Add PR32085 test.

spatel added a subscriber: spatel.Feb 28 2017, 12:23 PM
zvi added a subscriber: zvi.Mar 5 2017, 12:11 AM
filcab updated this revision to Diff 90873.Mar 7 2017, 10:03 AM

Updated patch. Ping!

Please can you reduce the test case?

davide requested changes to this revision.Mar 11 2017, 6:07 PM
davide added a subscriber: davide.

I agree with what Simon said. Some comments inline.

test/Other/pr32085.ll
1–2 ↗(On Diff #90873)

Not a very big fan of tests using -O2.
It's not the first time this has caused headaches to be while working on changes that make this kind of tests failing and tracking down becomes more and more fun.

That said. I think we need some infrastructure for integration testing (which we currently don't have). I also think the tests we have here should be kept as simple as possible to make sure we can debug them later easily.

103 ↗(On Diff #90873)

the attributes should be not really useful, for example (and if some of them are you can probably trim them down).

This revision now requires changes to proceed.Mar 11 2017, 6:07 PM
davide added inline comments.Mar 11 2017, 6:08 PM
lib/Transforms/IPO/PassManagerBuilder.cpp
665–667 ↗(On Diff #90873)

you need to add the equivalent in pass builder (in the new pass manager pipeline).

filcab updated this revision to Diff 91578.Mar 13 2017, 9:45 AM
filcab edited edge metadata.

Minimized test, fixed new pass manager test.

filcab updated this revision to Diff 91581.Mar 13 2017, 9:52 AM

Rebased to master.

RKSimon edited edge metadata.Mar 16 2017, 12:12 PM

No other comments from me.

RKSimon added inline comments.Mar 21 2017, 6:51 AM
test/Other/new-pm-defaults.ll
156 ↗(On Diff #91581)

Just stop at the pass name - thats what the other checks do.

No other comments from me, I'll be happy if @chandlerc can take a look

mehdi_amini added inline comments.Mar 21 2017, 3:27 PM
test/Other/pr32085.ll
8 ↗(On Diff #91581)

This seems like an incredibly fragile test to me: relying on the absence of a label name after running O1/O2/O3 doesn't seem robust enough to me.

I thought about the same problem Mehdi mentioned, but I have to say it's not Filipe's fault. In fact, the root cause is lack of proper integration testing in LLVM (GCC has infrastructure for that, FWIW).

filcab updated this revision to Diff 93262.Mar 28 2017, 11:00 AM

Fix revision comments.
Made the test a "show that running simplifyCFG on the output is a no-op" type of test.

Looks alright to me and the new approach to the test seems solid. Any other comments from anyone (@davide @mehdi_amini)?

RKSimon accepted this revision.Apr 25 2017, 1:40 PM

LGTM

This revision now requires changes to proceed.Apr 25 2017, 1:40 PM
This revision was automatically updated to reflect the committed changes.