[polly] r265261 - [FIX] Do not create two SAI objects for exit PHIs

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 3 04:16:02 PDT 2016


Author: jdoerfert
Date: Sun Apr  3 06:16:00 2016
New Revision: 265261

URL: http://llvm.org/viewvc/llvm-project?rev=265261&view=rev
Log:
[FIX] Do not create two SAI objects for exit PHIs

  If an exit PHI is written and also read in the SCoP we should not create two
  SAI objects but only one. As the read is only modeled to ensure OpenMP code
  generation knows about it we can simply use the EXIT_PHI MemoryKind for both
  accesses.

Added:
    polly/trunk/test/ScopInfo/exit-phi-1.ll
Modified:
    polly/trunk/lib/Analysis/ScopInfo.cpp

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=265261&r1=265260&r2=265261&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Sun Apr  3 06:16:00 2016
@@ -4334,9 +4334,13 @@ void ScopInfo::ensureValueRead(Value *V,
   if (UserStmt->lookupValueReadOf(V))
     return;
 
+  // For exit PHIs use the MK_ExitPHI MemoryKind not MK_Value.
+  ScopArrayInfo::MemoryKind Kind = ScopArrayInfo::MK_Value;
+  if (!ValueStmt && isa<PHINode>(V))
+    Kind = ScopArrayInfo::MK_ExitPHI;
+
   addMemoryAccess(UserBB, nullptr, MemoryAccess::READ, V, V->getType(), true, V,
-                  ArrayRef<const SCEV *>(), ArrayRef<const SCEV *>(),
-                  ScopArrayInfo::MK_Value);
+                  ArrayRef<const SCEV *>(), ArrayRef<const SCEV *>(), Kind);
   if (ValueInst)
     ensureValueWrite(ValueInst);
 }

Added: polly/trunk/test/ScopInfo/exit-phi-1.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/exit-phi-1.ll?rev=265261&view=auto
==============================================================================
--- polly/trunk/test/ScopInfo/exit-phi-1.ll (added)
+++ polly/trunk/test/ScopInfo/exit-phi-1.ll Sun Apr  3 06:16:00 2016
@@ -0,0 +1,39 @@
+; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
+; RUN: opt %loadPolly -polly-codegen -disable-output < %s
+;
+; Verify we only create one SAI object for up.3.ph as it is outside the SCoP.
+;
+; CHECK: Region: %for.body
+;
+; CHECK:         Arrays {
+; CHECK-NEXT:        i32* MemRef_A[*]; // Element size 8
+; CHECK-NEXT:        double MemRef_up_3_ph; // Element size 8
+; CHECK-NEXT:    }
+;
+; ModuleID = 'bugpoint-reduced-simplified.bc'
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+; Function Attrs: uwtable
+define void @_ZN6soplex14SPxAggregateSM9eliminateERKNS_7SVectorEd(i32** nocapture readonly %A) {
+entry:
+  br label %for.cond.outer304
+
+for.cond.outer304:                                ; preds = %if.else113, %if.then111, %entry
+  %up.3.ph = phi double [ 0.000000e+00, %entry ], [ undef, %if.else113 ], [ undef, %if.then111 ]
+  br i1 undef, label %for.body, label %for.end
+
+for.body:                                         ; preds = %for.cond.outer304
+  %0 = load i32*, i32** %A, align 8
+  %add = fadd double %up.3.ph, undef
+  %val.i.i.i235 = getelementptr inbounds i32, i32* %0, i64 0
+  br i1 false, label %if.else113, label %if.then111
+
+if.then111:                                       ; preds = %for.body
+  br label %for.cond.outer304
+
+if.else113:                                       ; preds = %for.body
+  br label %for.cond.outer304
+
+for.end:                                          ; preds = %for.cond.outer304
+  ret void
+}




More information about the llvm-commits mailing list