[Simplify] Remove identical scalar writes.
authorMichael Kruse <llvm@meinersbur.de>
Thu, 11 May 2017 15:07:38 +0000 (15:07 +0000)
committerMichael Kruse <llvm@meinersbur.de>
Thu, 11 May 2017 15:07:38 +0000 (15:07 +0000)
commit07e315e78032233873b894e162fff36dad2e6c97
treea206d440e09440f222f1257cb90a1151848036ca
parente2c055b8c5526da1b47f4746b33a72f5f70f8514
[Simplify] Remove identical scalar writes.

After DeLICM, it is possible to have two writes of the same value to
the same location in the same statement when it determined that those
writes do not conflict (write the same value).

Teach -polly-simplify to remove one of the writes. It interferes with
the pattern matching of matrix-multiplication kernels and also seem
to not be optimized away by LLVM.

The algorthm is simple, has O(n^2) behaviour (n = max number of
MemoryAccesses in a statement) and only matches the most obvious cases,
but seem to be enough to pattern-match Boost ublas gemm.

Not handled cases include:
- StoreInst instructions (a.k.a. explicit writes), since the value might
  be loaded or overwritten between the two stores.
- PHINode, especially LCSSA, when the PHI value matches with on other's.
- Partial writes (in preparation)

llvm-svn: 302805
polly/lib/Transform/Simplify.cpp
polly/test/Simplify/identical.ll [new file with mode: 0644]
polly/test/Simplify/identical_3phi.ll [new file with mode: 0644]
polly/test/Simplify/identical_3phi___%for---%return.jscop [new file with mode: 0644]
polly/test/Simplify/identical_3phi___%for---%return.jscop.transformed [new file with mode: 0644]
polly/test/Simplify/identical___%for---%return.jscop [new file with mode: 0644]
polly/test/Simplify/identical___%for---%return.jscop.transformed [new file with mode: 0644]