diff options
| author | Tobias Grosser <tobias@grosser.es> | 2017-05-05 13:20:47 +0000 |
|---|---|---|
| committer | Tobias Grosser <tobias@grosser.es> | 2017-05-05 13:20:47 +0000 |
| commit | d5727c5011ea0abcee8ef985ff33eeeca69e3949 (patch) | |
| tree | 3bfcc9996fdd34298d636bd1ba3962b187cf6e6a | |
| parent | e9c5d7b70b9e3e8403eb0343a483deb642c7894a (diff) | |
| download | bcm5719-llvm-d5727c5011ea0abcee8ef985ff33eeeca69e3949.tar.gz bcm5719-llvm-d5727c5011ea0abcee8ef985ff33eeeca69e3949.zip | |
Fix handling of signWrappedSets in access relations
Since r294891, in MemoryAccess::computeBoundsOnAccessRelation(), we skip
manually bounding the access relation in case the parameter of the load
instruction is already a wrapped set. Later on we assume that the lower
bound on the set is always smaller or equal to the upper bound on the
set. Bug 32715 manages to construct a sign wrapped set, in which case
the assertion does not necessarily hold. Fix this by handling a sign
wrapped set similar to a normal wrapped set, that is skipping the
computation.
Contributed-by: Maximilian Falkenstein <falkensm@student.ethz.ch>
Reviewers: grosser
Subscribers: pollydev, llvm-commits
Tags: #Polly
Differential Revision: https://reviews.llvm.org/D32893
llvm-svn: 302231
| -rw-r--r-- | polly/lib/Analysis/ScopInfo.cpp | 2 | ||||
| -rw-r--r-- | polly/test/ScopInfo/sign_wrapped_set.ll | 42 |
2 files changed, 43 insertions, 1 deletions
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index d68f121d96b..d70d99f3236 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -788,7 +788,7 @@ void MemoryAccess::computeBoundsOnAccessRelation(unsigned ElementSize) { if (Range.isFullSet()) return; - if (Range.isWrappedSet()) + if (Range.isWrappedSet() | Range.isSignWrappedSet()) return; bool isWrapping = Range.isSignWrappedSet(); diff --git a/polly/test/ScopInfo/sign_wrapped_set.ll b/polly/test/ScopInfo/sign_wrapped_set.ll new file mode 100644 index 00000000000..d8035cec4f2 --- /dev/null +++ b/polly/test/ScopInfo/sign_wrapped_set.ll @@ -0,0 +1,42 @@ +; RUN: opt %loadPolly -polly-scops -analyze \ +; RUN: -polly-allow-nonaffine -polly-process-unprofitable < %s | FileCheck %s +; +; CHECK: Domain := +; CHECK-NEXT: [srcHeight] -> { Stmt_for_cond6_preheader_us[i0] : 0 <= i0 <= -3 + srcHeight }; +; CHECK-NEXT: Schedule := +; CHECK-NEXT: [srcHeight] -> { Stmt_for_cond6_preheader_us[i0] -> [i0] }; +; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0] +; CHECK-NEXT: [srcHeight] -> { Stmt_for_cond6_preheader_us[i0] -> MemRef_src[o0] }; +; CHECK-NEXT: MayWriteAccess := [Reduction Type: +] [Scalar: 0] +; CHECK-NEXT: [srcHeight] -> { Stmt_for_cond6_preheader_us[i0] -> MemRef_src[o0] }; + +target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" + +define void @test_case(i8* noalias nocapture readonly %src, i32 %srcHeight, i32 %srcStride) local_unnamed_addr { +entry: + %extended = zext i32 %srcStride to i64 + %sub = add i32 %srcHeight, -1 + br label %for.cond6.preheader.us + +for.cond6.preheader.us: ; preds = %for.cond6.preheader.us, %entry + %srcPtr.075.us.pn = phi i8* [ %srcPtr.075.us, %for.cond6.preheader.us ], [ %src, %entry ] + %y.072.us = phi i32 [ %inc37.us, %for.cond6.preheader.us ], [ 1, %entry ] + %srcPtr.075.us = getelementptr inbounds i8, i8* %srcPtr.075.us.pn, i64 %extended + + %0 = load i8, i8* %srcPtr.075.us, align 1, !tbaa !0 + %1 = add i8 %0, 1 + store i8 %1, i8* %srcPtr.075.us, align 1, !tbaa !0 + + %inc37.us = add nuw i32 %y.072.us, 1 + %exitcond78 = icmp eq i32 %inc37.us, %sub + br i1 %exitcond78, label %for.cond.cleanup.loopexit, label %for.cond6.preheader.us + +for.cond.cleanup.loopexit: ; preds = %for.cond6.preheader.us + ret void +} + +!0 = !{!1, !1, i64 0} +!1 = !{!"omnipotent char", !2, i64 0} +!2 = !{!"Simple C++ TBAA"} +!3 = !{!4, !4, i64 0} +!4 = !{!"float", !1, i64 0} |

