[polly] r307660 - [Simplify] Also remove redundant writes which originally came from PHI nodes
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 11 07:29:39 PDT 2017
Author: grosser
Date: Tue Jul 11 07:29:39 2017
New Revision: 307660
URL: http://llvm.org/viewvc/llvm-project?rev=307660&view=rev
Log:
[Simplify] Also remove redundant writes which originally came from PHI nodes
Modified:
polly/trunk/lib/Transform/Simplify.cpp
polly/trunk/test/Simplify/gemm.ll
Modified: polly/trunk/lib/Transform/Simplify.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/Simplify.cpp?rev=307660&r1=307659&r2=307660&view=diff
==============================================================================
--- polly/trunk/lib/Transform/Simplify.cpp (original)
+++ polly/trunk/lib/Transform/Simplify.cpp Tue Jul 11 07:29:39 2017
@@ -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;
Modified: polly/trunk/test/Simplify/gemm.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Simplify/gemm.ll?rev=307660&r1=307659&r2=307660&view=diff
==============================================================================
--- polly/trunk/test/Simplify/gemm.ll (original)
+++ polly/trunk/test/Simplify/gemm.ll Tue Jul 11 07:29:39 2017
@@ -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[] };
More information about the llvm-commits
mailing list