[CodeGen] Fix order of PHINode and MA Write generation.

At the end of a region statement, the PHINode must be generated
while the current IRBuilder's block is the region's exit node. For
obvious reasons: The PHINode references the region's exiting block.
A partial write would insert new control flow, i.e. insert new basic
blocks between the exiting blocks and the current block.

We fix this by generating the PHI nodes (region exit values) before
generating any MemoryAccess's stores.

This should fix the AOSP buildbot.

Reported-by: Eli Friedman <efriedma@quicinc.com>

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@361204 91177308-0d34-0410-b5e6-96231b3b80d8
4 files changed