This is an archive of the discontinued LLVM Phabricator instance.

[ScopInfo] Use statement lists for entry blocks of region statements
ClosedPublic

Authored by grosser on Aug 30 2017, 6:17 AM.

Details

Summary

By using statement lists in the entry blocks of region statements, instruction
level analyses also work on region statements.

We currently only model the entry block of a region statements, as this is
sufficient for most transformations the known-passes currently execute. Modeling
instructions in the presence of control flow (e.g. infinite loops) is left
out to not increase code complexity too much. It can be added when good use
cases are found.

[BlockGenerator] Generate entry block of regions from instruction lists

The adds code generation support for the previous commit.

Event Timeline

grosser created this revision.Aug 30 2017, 6:17 AM
Meinersbur accepted this revision.Aug 30 2017, 6:42 AM

I don't see any correctness issues: LGTM.

include/polly/ScopInfo.h
1209

Instead of passing std::vector by value, wouldn't it be better to pass an ArrayRef?

lib/Analysis/ScopBuilder.cpp
667–670

Can we refactor this shared code (with block stmts) into e.g. common function?

lib/Analysis/ScopInfo.cpp
1684

Empty line?

3596–3597

This code is also shared with the block stmt case.

3600–3601

Should this be

if (BB != Stmt.getEntryBlock())
   continue;

?

lib/CodeGen/BlockGenerators.cpp
458

Simpler: Stmt.getEntryBlock() == BB which should work for the block stmt and region stmt case.

However, your version makes it more explicit what was intended.

This revision is now accepted and ready to land.Aug 30 2017, 6:42 AM
grosser marked an inline comment as done.Aug 30 2017, 8:06 AM
grosser added inline comments.
include/polly/ScopInfo.h
1209

Possibly, but I wanted to mirror the existing code. I will commit this as a follow up cleanup.

lib/Analysis/ScopBuilder.cpp
667–670

I extracted out a method shouldModelInst. I could not include the loop, as I did not yet want to allow statement
splitting in region statements.

lib/Analysis/ScopInfo.cpp
3596–3597

Pulled out.

3600–3601

No. I added a comment:

// Skip entry basic block, as its instructions are already deleted as      
// part of the statement's instruction list.
lib/CodeGen/BlockGenerators.cpp
458

OK, then I will leave my code.

grosser closed this revision.Aug 30 2017, 9:51 PM

This was committed in 312211.