[Simplify] Remove writes that are overwritten.
commitad5ef16e38a7809a0c9d6988f8e2a248385f62a0
authorMichael Kruse <llvm@meinersbur.de>
Sat, 13 May 2017 11:49:34 +0000 (13 11:49 +0000)
committerMichael Kruse <llvm@meinersbur.de>
Sat, 13 May 2017 11:49:34 +0000 (13 11:49 +0000)
treea58900758d80cb98e5bd822557b20bcb9cc651d7
parent52430d6f1a19b1364e0e5497737ef32be7a0f8e8
[Simplify] Remove writes that are overwritten.

Remove memory writes that are overwritten by later writes. This works
for StoreInsts:

      store double 21.0, double* %A
      store double 42.0, double* %A

scalar writes at the end of a statement and mixes of these.

Multiple writes can be the result of DeLICM, which might map multiple
writes to the same location when it knows that these do no conflict
(for instance because they write the same value). Such writes
interfere with pattern-matched optimization such as gemm and may not
get removed by other LLVM passes after code generation.

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

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@302986 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transform/Simplify.cpp
test/Simplify/overwritten.ll [new file with mode: 0644]
test/Simplify/overwritten_3store.ll [new file with mode: 0644]
test/Simplify/overwritten_implicit_and_explicit.ll [new file with mode: 0644]
test/Simplify/overwritten_implicit_and_explicit___%for---%return.jscop [new file with mode: 0644]
test/Simplify/overwritten_implicit_and_explicit___%for---%return.jscop.transformed [new file with mode: 0644]
test/Simplify/overwritten_loadbetween.ll [new file with mode: 0644]