llvm-project/polly/test
Sebastian Pop 9f57c5b695 scop detection: properly instantiate SCEVs to the place where they are used
Fix inspired from c2d4a0627e95c34a819b9d4ffb4db62daa78dade.

    Given the following code

        for (i = 0; i < 10; i++) {
          ;
        }

    S:  A[i] = 0

    When translate the data reference A[i] in statement S using scev, we need to
    retrieve the scev of 'i' at the location of 'S'. If we do not do this the
    scev that we obtain will be expressed as {0,+,1}_for and will reference loop
    iterators that do not surround 'S'. What we really want is the scev to be
    instantiated to the value of 'i' after the loop. This value is {10}.

This used to crash in:

    int loopDimension = getLoopDepth(Expr->getLoop());

    isl_aff *LAff = isl_aff_set_coefficient_si(
        isl_aff_zero_on_domain(LocalSpace), isl_dim_in, loopDimension, 1);

(gdb) p Expr->dump()
{8,+,8}<nw><%do.body>

(gdb) p getLoopDepth(Expr->getLoop())
$5 = 0

    isl_space *Space = isl_space_set_alloc(Ctx, 0, NbLoopSpaces);
    isl_local_space *LocalSpace = isl_local_space_from_space(Space);

As we are trying to create a memory access in a stmt that is outside all loops,
LocalSpace has 0 dimensions:

(gdb) p NbLoopSpaces
$12 = 0

(gdb) p Statement.BB->dump()

if.then:                                          ; preds = %do.end
  %0 = load float* %add.ptr, align 4
  store float %0, float* %q.1.reg2mem, align 4
  br label %if.end.single_exit

and so the scev for %add.ptr should be taken at the place where it is used,
i.e., it should be the value on the last iteration of the do.body loop, and not
"{8,+,8}<nw><%do.body>".

llvm-svn: 179148
2013-04-10 04:05:18 +00:00
..
Cloog tests: Properly check if asserts are available 2013-03-12 21:27:39 +00:00
CodePreparation CodePrepare: Do not require canonical induction variables for scev based mode 2013-03-20 22:41:53 +00:00
Dependences Dependences: Add support to calculate memory based dependences 2012-11-01 21:28:32 +00:00
IndependentBlocks Remove dependence on canonical induction variable 2013-03-20 18:03:18 +00:00
Isl IndependentBlocks: translate out of SSA all uses escaping the region 2013-04-08 13:05:41 +00:00
ScheduleOptimizer execute cloog specific testcases only with CLOOG_FOUND 2012-12-03 21:33:40 +00:00
ScopDetect scop detection: properly instantiate SCEVs to the place where they are used 2013-04-10 04:05:18 +00:00
ScopInfo tests: Properly check if asserts are available 2013-03-12 21:27:39 +00:00
TempScop Tests: move content of .c files in .ll 2012-11-02 06:08:39 +00:00
polybench clang-format: Many more files 2013-03-23 01:05:07 +00:00
CMakeLists.txt Integrate polly test-suite into an llvm "make check-all" if built as part of the whole using cmake. 2012-12-06 07:59:18 +00:00
Makefile Revert "Make the "all" target depend on polly-test, so that users can run regression" 2012-04-11 07:43:24 +00:00
README Add initial version of Polly 2011-04-29 06:27:02 +00:00
create_ll.sh Add initial version of Polly 2011-04-29 06:27:02 +00:00
lit.cfg tests: Properly check if asserts are available 2013-03-12 21:27:39 +00:00
lit.site.cfg.in Integrate polly test-suite into an llvm "make check-all" if built as part of the whole using cmake. 2012-12-06 07:59:18 +00:00
polly.ll Add initial version of Polly 2011-04-29 06:27:02 +00:00

README

place tests here