[ScopInfo] Use map for value def/PHI read accesses.
commit2d3f56beb5f500d48d499bfdef431f0d80d590a1
authorMichael Kruse <llvm@meinersbur.de>
Thu, 21 Sep 2017 14:23:11 +0000 (21 14:23 +0000)
committerMichael Kruse <llvm@meinersbur.de>
Thu, 21 Sep 2017 14:23:11 +0000 (21 14:23 +0000)
tree68145537300436d76bde5eb444ccb7ab38f85668
parent6c392b420026404dc8f03e0d6cde6424a17ba275
[ScopInfo] Use map for value def/PHI read accesses.

Before this patch, ScopInfo::getValueDef(SAI) used
getStmtFor(Instruction*) to find the MemoryAccess that writes a
MemoryKind::Value. In cases where the value is synthesizable within the
statement that defines, the instruction is not added to the statement's
instruction list, which means getStmtFor() won't return anything.

If the synthesiable instruction is not synthesiable in a different
statement (due to being defined in a loop that and ScalarEvolution
cannot derive its escape value), we still need a MemoryKind::Value
and a write to it that makes it available in the other statements.
Introduce a separate map for this purpose.

This fixes MultiSource/Benchmarks/MallocBench/cfrac where
-polly-simplify could not find the writing MemoryAccess for a use. The
write was not marked as required and consequently was removed.

Because this could in principle happen as well for PHI scalars,
add such a map for PHI reads as well.

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@313881 91177308-0d34-0410-b5e6-96231b3b80d8
include/polly/ScopInfo.h
lib/Analysis/ScopInfo.cpp
test/Simplify/notredundant_synthesizable_unknownit.ll [new file with mode: 0644]