This is an archive of the discontinued LLVM Phabricator instance.

Allow PHI nodes in the exit block of regions
ClosedPublic

Authored by jdoerfert on Aug 15 2015, 1:50 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

jdoerfert updated this revision to Diff 32218.Aug 15 2015, 1:50 AM
jdoerfert retitled this revision from to Allow PHI nodes in the exit block of regions.
jdoerfert added reviewers: grosser, Meinersbur.
jdoerfert updated this object.
jdoerfert added a subscriber: Restricted Project.
Meinersbur edited edge metadata.Aug 15 2015, 3:36 PM

It's basically like my solution: Ensure that TempScopInfo generates write accesses and that BlockGenerators adds the PHIs to EscapeMap.

lib/Analysis/TempScopInfo.cpp
114 ↗(On Diff #32218)

What happens otherwise?

470 ↗(On Diff #32218)

if (!R.getExitingBlock())

lib/CodeGen/BlockGenerators.cpp
495 ↗(On Diff #32218)

assert(!OperandPHI)

499 ↗(On Diff #32218)

assert(OperandPHI);

532 ↗(On Diff #32218)

Is this necessary? Can't one just use the original PHI to represent the virtual memory location? It's not directly used anyway.

543 ↗(On Diff #32218)

escape

1202 ↗(On Diff #32218)

The last 30 lines are repetative. Refactor?

jdoerfert marked an inline comment as done.Aug 16 2015, 1:34 AM

I will push another version later.

The problematic part I encountered are PHI nodes that use values as operands. Here I tried to circumvent them by looking through the new PHI node in the exit and replacing it dynamically with the one that is now in the region [BlockGenerators.cpp:529]. However, I don't like this solution so I came up with a different one I will push here.

lib/Analysis/TempScopInfo.cpp
114 ↗(On Diff #32218)

The PHI operands are not modeled, hence never stored into the escape location.

470 ↗(On Diff #32218)

True.

lib/CodeGen/BlockGenerators.cpp
532 ↗(On Diff #32218)

I don't think so as it is linked via the escape map to the rewiring at the end.

1202 ↗(On Diff #32218)

That might be an idea for a different patch though.

jdoerfert updated this revision to Diff 32236.Aug 16 2015, 1:54 AM
jdoerfert marked an inline comment as done.
jdoerfert edited edge metadata.
  • Remove trivial condition
  • Allow values to cause memory accesses
  • Allow PHI nodes in the region exit block
grosser edited edge metadata.Aug 18 2015, 12:06 AM

Hi Johannes,

can you rebase this to get rid of the AccessVal changes?

jdoerfert updated this revision to Diff 32402.Aug 18 2015, 5:10 AM
jdoerfert edited edge metadata.

Rebase to upstream with only the actuall commit in the diff

This patch fails only the pairalign lnt execution test.

@Meinersbur Does your patch pass that one? If so can you rebase your patch to the upstram I want to see the difference in the generated L__align11 function that is apperently wrong.

jdoerfert updated this revision to Diff 33822.Sep 2 2015, 10:26 AM

Rebased and working version

This revision was automatically updated to reflect the committed changes.