[polly] r311920 - [IslAst] Do not compare arrays in alias check which are known to be identical
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 28 13:17:02 PDT 2017
Author: grosser
Date: Mon Aug 28 13:17:02 2017
New Revision: 311920
URL: http://llvm.org/viewvc/llvm-project?rev=311920&view=rev
Log:
[IslAst] Do not compare arrays in alias check which are known to be identical
This possibly helps to avoid run-time check failures in the COSMO kernels.
Added:
polly/trunk/test/Isl/Ast/aliasing_arrays_with_identical_base.ll
Modified:
polly/trunk/lib/CodeGen/IslAst.cpp
Modified: polly/trunk/lib/CodeGen/IslAst.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslAst.cpp?rev=311920&r1=311919&r2=311920&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslAst.cpp (original)
+++ polly/trunk/lib/CodeGen/IslAst.cpp Mon Aug 28 13:17:02 2017
@@ -350,6 +350,20 @@ static __isl_give isl_ast_node *AtEachDo
static __isl_give isl_ast_expr *
buildCondition(__isl_keep isl_ast_build *Build, const Scop::MinMaxAccessTy *It0,
const Scop::MinMaxAccessTy *It1) {
+ isl::id Left =
+ isl::manage(isl_pw_multi_aff_get_tuple_id(It0->first, isl_dim_set));
+ isl::id Right =
+ isl::manage(isl_pw_multi_aff_get_tuple_id(It1->first, isl_dim_set));
+
+ const ScopArrayInfo *BaseLeft =
+ ScopArrayInfo::getFromId(Left)->getBasePtrOriginSAI();
+ const ScopArrayInfo *BaseRight =
+ ScopArrayInfo::getFromId(Right)->getBasePtrOriginSAI();
+ if (BaseLeft && BaseLeft == BaseRight) {
+ return isl_ast_expr_from_val(
+ isl_val_int_from_si(isl_ast_build_get_ctx(Build), 1));
+ }
+
isl_ast_expr *NonAliasGroup, *MinExpr, *MaxExpr;
MinExpr = isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
Build, isl_pw_multi_aff_copy(It0->first)));
Added: polly/trunk/test/Isl/Ast/aliasing_arrays_with_identical_base.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/Ast/aliasing_arrays_with_identical_base.ll?rev=311920&view=auto
==============================================================================
--- polly/trunk/test/Isl/Ast/aliasing_arrays_with_identical_base.ll (added)
+++ polly/trunk/test/Isl/Ast/aliasing_arrays_with_identical_base.ll Mon Aug 28 13:17:02 2017
@@ -0,0 +1,33 @@
+; RUN: opt %loadPolly -polly-ast -analyze < %s \
+; RUN: -polly-invariant-load-hoisting \
+; RUN: | FileCheck %s
+
+; CHECK: if (1 && 1 && (&MemRef_X[1] <= &MemRef_BaseA[0] || &MemRef_BaseA[1024] <= &MemRef_X[0]) && (&MemRef_X[1] <= &MemRef_BaseB[0] || &MemRef_BaseB[1024] <= &MemRef_X[0]))
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @foo(float** nocapture readonly %X) {
+entry:
+ br label %for.body
+
+for.cond.cleanup:
+ ret void
+
+for.body:
+ %i.011 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
+ %conv = sitofp i64 %i.011 to float
+ %BaseA = load float*, float** %X, align 8
+ %BaseB = load float*, float** %X, align 8
+ %arrayidx = getelementptr inbounds float, float* %BaseA, i64 %i.011
+ %A = load float, float* %arrayidx, align 4
+ %add = fadd float %A, %conv
+ store float %add, float* %arrayidx, align 4
+ %arrayidxB = getelementptr inbounds float, float* %BaseB, i64 %i.011
+ %B = load float, float* %arrayidxB, align 4
+ %addB = fadd float %B, %conv
+ store float %addB, float* %arrayidxB, align 4
+ %inc = add nuw nsw i64 %i.011, 1
+ %exitcond = icmp eq i64 %inc, 1024
+ br i1 %exitcond, label %for.cond.cleanup, label %for.body
+}
More information about the llvm-commits
mailing list