[PATCH] Use ScalarEvolution to create tight bounds on the parameters
Sebastian Pop
sebpop at gmail.com
Thu Feb 12 07:49:06 PST 2015
On Thu, Feb 12, 2015 at 2:03 AM, Johannes Doerfert
<doerfert at cs.uni-saarland.de> wrote:
> Index: test/ScopInfo/ranged_parameter.ll
> ===================================================================
> --- /dev/null
> +++ test/ScopInfo/ranged_parameter.ll
> @@ -0,0 +1,38 @@
> +; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
> +;
> +; CHECK: Context:
> +; CHECK: [p_0] -> { : p_0 >= 0 and p_0 <= 255 }
> +;
> +; void jd(int *A, int *p /* in [0,256) */) {
I don't see A statically defined, so we don't know its size, and so I wonder
what information do we look at to compute that *p is in [0,256)?
> +; for (int i = 0; i < 1024; i++)
> +; A[i + *p] = i;
> +; }
> +;
> +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
> +
> +define void @jd(i32* %A, i32* %p) {
> +entry:
> + %tmp = load i32* %p, align 4, !range !0
> + br label %for.cond
> +
> +for.cond: ; preds = %for.inc, %entry
> + %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
> + %exitcond = icmp ne i32 %i.0, 1024
> + br i1 %exitcond, label %for.body, label %for.end
> +
> +for.body: ; preds = %for.cond
> + %add = add i32 %i.0, %tmp
> + %idxprom = sext i32 %add to i64
> + %arrayidx = getelementptr inbounds i32* %A, i64 %idxprom
> + store i32 %i.0, i32* %arrayidx, align 4
> + br label %for.inc
> +
> +for.inc: ; preds = %for.body
> + %inc = add nsw i32 %i.0, 1
> + br label %for.cond
> +
> +for.end: ; preds = %for.cond
> + ret void
> +}
> +
> +!0 = !{ i32 0, i32 256 }
>
> EMAIL PREFERENCES
> http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list