diff options
author | Tobias Grosser <tobias@grosser.es> | 2017-07-11 14:29:39 +0000 |
---|---|---|
committer | Tobias Grosser <tobias@grosser.es> | 2017-07-11 14:29:39 +0000 |
commit | bed2ca6eac1e507319f77cfce98506ccbb0808ae (patch) | |
tree | f0aee4a2dfaca60866e073e7abb724ce0ff92c3d /polly | |
parent | be9a2e2c84f98db135b0c4adc7808f3a9a88f84b (diff) | |
download | llvm-bed2ca6eac1e507319f77cfce98506ccbb0808ae.zip llvm-bed2ca6eac1e507319f77cfce98506ccbb0808ae.tar.gz llvm-bed2ca6eac1e507319f77cfce98506ccbb0808ae.tar.bz2 |
[Simplify] Also remove redundant writes which originally came from PHI nodes
llvm-svn: 307660
Diffstat (limited to 'polly')
-rw-r--r-- | polly/lib/Transform/Simplify.cpp | 9 | ||||
-rw-r--r-- | polly/test/Simplify/gemm.ll | 6 |
2 files changed, 8 insertions, 7 deletions
diff --git a/polly/lib/Transform/Simplify.cpp b/polly/lib/Transform/Simplify.cpp index d72de18..c379f4d 100644 --- a/polly/lib/Transform/Simplify.cpp +++ b/polly/lib/Transform/Simplify.cpp @@ -235,10 +235,17 @@ private: continue; if (!WA->isLatestArrayKind()) continue; - if (!isa<StoreInst>(WA->getAccessInstruction())) + if (!isa<StoreInst>(WA->getAccessInstruction()) && !WA->isPHIKind()) continue; auto ReadingValue = WA->getAccessValue(); + + if (WA->isPHIKind()) { + PHINode *PHI = cast<PHINode>(WA->getAccessValue()); + BasicBlock *BB = Stmt.getBasicBlock(); + ReadingValue = PHI->getIncomingValueForBlock(BB); + } + if (!ReadingValue) continue; diff --git a/polly/test/Simplify/gemm.ll b/polly/test/Simplify/gemm.ll index 8b5afa6..f048a4a 100644 --- a/polly/test/Simplify/gemm.ll +++ b/polly/test/Simplify/gemm.ll @@ -13,12 +13,6 @@ ; } ; CHECK: After accesses { -; CHECK-NEXT: Stmt_bb8 -; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0] -; CHECK-NEXT: { Stmt_bb8[i0, i1] -> MemRef_C[i0, i1] }; -; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1] -; CHECK-NEXT: { Stmt_bb8[i0, i1] -> MemRef_tmp_0__phi[] }; -; CHECK-NEXT: new: { Stmt_bb8[i0, i1] -> MemRef_C[i0, i1] }; ; CHECK-NEXT: Stmt_bb10 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1] ; CHECK-NEXT: { Stmt_bb10[i0, i1, i2] -> MemRef_tmp_0__phi[] }; |