[CodeGen] Detect impossible partial write conditions more reliably.
commit861a127da3482701083d3eb9283da332ab4c7184
authorMichael Kruse <llvm@meinersbur.de>
Thu, 24 Aug 2017 14:51:35 +0000 (24 14:51 +0000)
committerMichael Kruse <llvm@meinersbur.de>
Thu, 24 Aug 2017 14:51:35 +0000 (24 14:51 +0000)
treed0319fe1c0980a9bf8c5cf962ba6d339c03cc77c
parent51d080da5d296195a931f3cfda4dc8e5cd741ea6
[CodeGen] Detect impossible partial write conditions more reliably.

Whether a partial write is tautological/unsatisfiable not only
depends on the access domain, but also on the domain covered
by its node in the AST.

In the example below, there are two instances of Stmt_cond_false. It may have a partial write access that is not executed in instance Stmt_cond_false(0).

      for (int c0 = 0; c0 < tmp5; c0 += 1) {
        Stmt_for_body344(c0);
        if (tmp5 >= c0 + 2)
          Stmt_cond_false(c0);
        Stmt_cond_end(c0);
      }
      if (tmp5 <= 0) {
        Stmt_for_body344(0);
        Stmt_cond_false(0);
        Stmt_cond_end(0);
      }

Isl cannot derive a subscript for an array element that is never accessed.
This caused an error in that no subscript expression has been generated
in IslNodeBuilder::createNewAccesses, but BlockGenerator expected one
to exist because there is an execution of that write, just not in that
ast node.

Fixed by instead of determining whether the access domain is empty,
inspect whether isl generated a constant "false" ast expression in
the current ast node.

This should fix a compiler crash of the aosp buildbot.

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@311663 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/BlockGenerators.cpp
test/Isl/CodeGen/partial_write_impossible_restriction.ll [new file with mode: 0644]
test/Isl/CodeGen/partial_write_impossible_restriction___%for.body344---%if.then.i.i1141.loopexit.jscop [new file with mode: 0644]
test/Isl/CodeGen/partial_write_impossible_restriction___%for.body344---%if.then.i.i1141.loopexit.jscop.transformed [new file with mode: 0644]