[polly] r251227 - ScopDetection: Update DetectionContextMap accordingly
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 25 03:55:36 PDT 2015
Author: grosser
Date: Sun Oct 25 05:55:35 2015
New Revision: 251227
URL: http://llvm.org/viewvc/llvm-project?rev=251227&view=rev
Log:
ScopDetection: Update DetectionContextMap accordingly
When verifying if a scop is still valid we rerun all analysis, but did not
update DetectionContextMap. This change ensures that information, e.g. about
non-affine regions, is correctly updated
Added:
polly/trunk/test/Isl/CodeGen/multiple-scops-in-a-row.ll
Modified:
polly/trunk/include/polly/ScopDetection.h
polly/trunk/lib/Analysis/ScopDetection.cpp
Modified: polly/trunk/include/polly/ScopDetection.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopDetection.h?rev=251227&r1=251226&r2=251227&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopDetection.h (original)
+++ polly/trunk/include/polly/ScopDetection.h Sun Oct 25 05:55:35 2015
@@ -201,7 +201,7 @@ private:
/// @brief Map to remember detection contexts for valid regions.
using DetectionContextMapTy = DenseMap<const Region *, DetectionContext>;
- DetectionContextMapTy DetectionContextMap;
+ mutable DetectionContextMapTy DetectionContextMap;
// Remember a list of errors for every region.
mutable RejectLogsContainer RejectLogs;
Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=251227&r1=251226&r2=251227&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Sun Oct 25 05:55:35 2015
@@ -254,7 +254,11 @@ bool ScopDetection::isMaxRegionInScop(co
return false;
if (Verify) {
- DetectionContext Context(const_cast<Region &>(R), *AA, false /*verifying*/);
+ DetectionContextMap.erase(&R);
+ const auto &It = DetectionContextMap.insert(
+ std::make_pair(&R, DetectionContext(const_cast<Region &>(R), *AA,
+ false /*verifying*/)));
+ DetectionContext &Context = It.first->second;
return isValidRegion(Context);
}
Added: polly/trunk/test/Isl/CodeGen/multiple-scops-in-a-row.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/multiple-scops-in-a-row.ll?rev=251227&view=auto
==============================================================================
--- polly/trunk/test/Isl/CodeGen/multiple-scops-in-a-row.ll (added)
+++ polly/trunk/test/Isl/CodeGen/multiple-scops-in-a-row.ll Sun Oct 25 05:55:35 2015
@@ -0,0 +1,51 @@
+; RUN: opt %loadPolly -S -polly-codegen < %s | FileCheck %s
+
+; This test case has two scops in a row. When code generating the first scop,
+; the second scop is invalidated. This test case verifies that we do not crash
+; due to incorrectly assuming the second scop is still valid.
+
+; We explicitly check here that the second scop is not code generated. Later
+; improvements may make this possible (e.g., Polly gaining support for
+; parameteric conditional expressions or a changed code generation order).
+; However, in case this happens, we want to ensure this test case is been
+; reasoned about and updated accordingly.
+
+; CHECK: polly.start:
+; CHECK-NOT: polly.start:
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+define void @hoge(i8* %arg) {
+bb:
+ br label %bb1
+
+bb1: ; preds = %bb
+ %tmp = getelementptr inbounds i8, i8* %arg, i64 5
+ %tmp2 = getelementptr inbounds i8, i8* %arg, i64 6
+ br i1 false, label %bb3, label %bb4
+
+bb3: ; preds = %bb1
+ br label %bb4
+
+bb4: ; preds = %bb3, %bb1
+ %tmp5 = icmp eq i32 0, 1
+ br label %bb6
+
+bb6: ; preds = %bb4
+ br i1 undef, label %bb7, label %bb8
+
+bb7: ; preds = %bb6
+ unreachable
+
+bb8: ; preds = %bb6
+ br i1 %tmp5, label %bb9, label %bb10
+
+bb9: ; preds = %bb8
+ br label %bb11
+
+bb10: ; preds = %bb8
+ br label %bb11
+
+bb11: ; preds = %bb10, %bb9
+ ret void
+}
More information about the llvm-commits
mailing list