[Polly][CodeGen] Remove use of ScalarEvolution.
authorMichael Kruse <llvm-project@meinersbur.de>
Mon, 7 Dec 2020 20:39:32 +0000 (14:39 -0600)
committerMichael Kruse <llvm-project@meinersbur.de>
Mon, 7 Dec 2020 21:21:51 +0000 (15:21 -0600)
commit6249bfeefeed7ee2634355d4d7523b46fb00fda6
treece8beb84b0aa6d588abeaf28bd5780b8620371be
parent399bc48eccf0d983a8a4644c12ed9cc21ff33f33
[Polly][CodeGen] Remove use of ScalarEvolution.

ScalarEvolution::getSCEV cannot be used during codegen. ScalarEvolution
assumes a stable IR and control flow which is under construction during
Polly's CodeGen. In particular, it uses DominatorTree for compute the
backedge taken count. However the DominatorTree is not updated during
codegen.

In this case, SCEV was used to determine the base pointer of an array
access. Replace it by our own function. Polly generates only GEP and
BitCasts for array acceses, i.e. it is sufficient to handle these to to
find the base pointer.

Fixes llvm.org/PR48422
polly/lib/CodeGen/IRBuilder.cpp
polly/test/Isl/CodeGen/scev-backedgetaken.ll [new file with mode: 0644]