This is an archive of the discontinued LLVM Phabricator instance.

[Polly] Avoid unnecessay .s2a write access when used only in PHIs
ClosedPublic

Authored by Meinersbur on Oct 17 2015, 11:12 AM.

Details

Summary

Accesses for exit node phis will be handled separately by buildPHIAccesses if there is more than one exiting edge, buildScalarDependences does not need to create additional SCALAR accesses.

This is a corrected version of r250517, which was reverted in r250607.

Diff Detail

Repository
rL LLVM

Event Timeline

Meinersbur retitled this revision from to [Polly] Avoid unnecessay .s2a write access when used only in PHIs.
Meinersbur updated this object.
Meinersbur added reviewers: grosser, jdoerfert.
Meinersbur added a project: Restricted Project.
Meinersbur added subscribers: llvm-commits, pollydev.
grosser accepted this revision.Oct 17 2015, 12:33 PM
grosser edited edge metadata.

Hi Michael,

this now LGTM. I just had one comment on how to possibly make this code more understandable.

Best,
Tobias

lib/Analysis/ScopInfo.cpp
3277 ↗(On Diff #37686)

is A single exiting block

What are 'node PHIs'? Do you mean PHI nodes?

The last sentence is incomplete. It does not contain a verb in the main phrase.

It also took me a little while to understand this condition. I have the feeling moving this check into its own condition and elaborating a little more on why we bail out may make this more understandable. Does the following explain correctly what is going on? If it does, maybe you want to add some of this information to your final commit.

// Check for PHI nodes in the region exit and skip them, if they will be modeled
// as PHI nodes.
// 
// PHI nodes in the region exit that have more than two incoming edges need to
// be modeled as PHI-Nodes to correctly model the fact that depending on the
// control flow a different value will be assigned to the PHI node. In case this
// is the case, there is no need to create an additional normal scalar dependence.
// Hence bail out, before we register an "out-of-region" use for this definition.
if (isa<PHINode>(UI) && UI->getParent() == R->getExit() &&                    
    !R->getExitingBlock())                                                    
  continue;                                                                   
                                                                              
// Check whether or not the use is in the SCoP.                               
if (!R->contains(UseParent)) {                                                
  AnyCrossStmtUse = true;                                                     
  continue;                                                                   
}
This revision is now accepted and ready to land.Oct 17 2015, 12:33 PM
Meinersbur updated this revision to Diff 37688.Oct 17 2015, 1:40 PM
Meinersbur edited edge metadata.

Use Tobias' more detailed comment.

This revision was automatically updated to reflect the committed changes.