In case there are dependences from multiple scalars inside the region to a single PHI node in the exit block of the region, it is unclear which value needs to be stored in the PHI node.
Example:
bb: br %cond, stmtA, stmt B, stmtA: br merge stmtB: br merge merge: %val = phi [%valA, %stmtA], [%valB, stmtB] ret %val
For the region (bb -> merge), the value that needs to be stored in %val is %valA, if the PHI node is reached through %stmtA, and %valB, if the PHI node is reached through %stmtB. Hence, at code generation time we can not just store the value of a specific scalar in the PHI node, but need to "choose" between the values of multiple scalars. For this we use the same approach as we use for PHI nodes in general, we add virtual writes to a PHI-node location and then read back the original value in the exiting block.
This patch removes the check in ScopDetection for PHI nodes in the exit node and teaches TempScopInfo to generate access information for them. The PHI nodes are later found and handled by CodeGeneration to reload the writes into a scalar.
Modification of the IR before CodeGeneration is avoided because we do not want the IR changed if there are Scop-level optimizations to be applied or we do analysis only.
space after 'by'