[Simplify] Rewrite redundant write detection algorithm.
commit3652b357ce709839460caed465af49051d85e81e
authorMichael Kruse <llvm@meinersbur.de>
Tue, 1 Aug 2017 20:01:34 +0000 (1 20:01 +0000)
committerMichael Kruse <llvm@meinersbur.de>
Tue, 1 Aug 2017 20:01:34 +0000 (1 20:01 +0000)
treec5e5a0f7706b63bde55c362f5055e18649d3580d
parent08c600e1dcb3d5ac550c773347768f9bedb68b06
[Simplify] Rewrite redundant write detection algorithm.

The previous algorithm was to search a writes and the sours of its value
operand, and see whether the write just stores the same read value back,
which includes a search whether there is another write access between
them. This is O(n^2) in the max number of accesses in a statement
(+ the complexity of isl comparing the access functions).

The new algorithm is more similar to the one used for searching for
overwrites and coalescable writes. It scans over all accesses in order
of execution while tracking which array elements still have the same
value since it was read. This is O(n), not counting the complexity
within isl. It should be more reliable than trying to catch all
non-conforming cases in the previous approach. It is also less code.

We now also support if the write is a partial write of the read's
domain, and to some extent non-affine subregions.

Differential Revision: https://reviews.llvm.org/D36137

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@309734 91177308-0d34-0410-b5e6-96231b3b80d8
16 files changed:
lib/Transform/Simplify.cpp
test/Simplify/notredundant_region_loop.ll [new file with mode: 0644]
test/Simplify/notredundant_region_loop___%for---%return.jscop [new file with mode: 0644]
test/Simplify/notredundant_region_loop___%for---%return.jscop.transformed [new file with mode: 0644]
test/Simplify/notredundant_region_middle.ll [new file with mode: 0644]
test/Simplify/redundant_differentindex.ll
test/Simplify/redundant_partialwrite.ll [new file with mode: 0644]
test/Simplify/redundant_partialwrite___%for---%return.jscop [new file with mode: 0644]
test/Simplify/redundant_partialwrite___%for---%return.jscop.transformed [new file with mode: 0644]
test/Simplify/redundant_region.ll [new file with mode: 0644]
test/Simplify/redundant_region___%for---%return.jscop [new file with mode: 0644]
test/Simplify/redundant_region___%for---%return.jscop.transformed [new file with mode: 0644]
test/Simplify/redundant_region_scalar.ll [new file with mode: 0644]
test/Simplify/redundant_region_scalar___%for---%return.jscop [new file with mode: 0644]
test/Simplify/redundant_region_scalar___%for---%return.jscop.transformed [new file with mode: 0644]
test/Simplify/redundant_storebetween.ll