[patch] Cleanup and improvement of if-conversion for vectorization

Sebastian Pop sebpop@gmail.com
Mon May 24 18:38:00 GMT 2010


Hi,

The attached patch-set cleans the code of the current if-conversion
pass, separates the analysis of the basic block predicates from the
transformation, and improves the if-conversion by transforming loops
containing conditions with memory references.  Conditional writes to
memory are handled as non conditional writes by reading and writing
back the same value, like this:

+/* Predicate each write to memory in LOOP.
+
+   Replace a statement "A[i] = foo" with "A[i] = cond ? foo : A[i]"
+   with the condition COND determined from the ->aux field of the
+   basic block containing the statement.  */

With this patch set, I am XFAIL-ing vect-ifcvt-18.c that I am
considering unsafe for the if-conversion as currently implemented in
trunk.  I am XFAIL-ing it until I get a patch that checks that a
statically allocated data reference cannot trap in a loop accessed
niter times.  vect-ifcvt-18.c looks like the testcase of
http://gcc.gnu.org/PR43423

__attribute__ ((noinline)) void
foo (int mid, int n)
{
  int i;

  for (i = 0; i < n; i++)
    if (i < mid)
      A[i] = A[i] + B[i];
    else
      A[i] = A[i] + C[i];
}

After if-conversion the accesses to B and C would be executed for
every iteration, and without proving that B and C have "n" elements,
the if-converted code could trap.

The patch-set passes test and bootstrap with BOOT_CFLAGS="-g -O3".
Ok for trunk?

Thanks,
Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-bootstrap-at-O3.patch
Type: text/x-diff
Size: 810 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100524/a4b2b205/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Handle-COND_EXPRs-in-alias-analysis.patch
Type: text/x-diff
Size: 2580 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100524/a4b2b205/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Fix-comments.patch
Type: text/x-diff
Size: 1783 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100524/a4b2b205/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Make-tree_if_conversion-not-return-a-bool.patch
Type: text/x-diff
Size: 1353 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100524/a4b2b205/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Do-not-compute-free-CDI_POST_DOMINATORS.patch
Type: text/x-diff
Size: 1479 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100524/a4b2b205/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-Add-a-debug-counter-for-the-tree-ssa-level-if-conver.patch
Type: text/x-diff
Size: 2609 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100524/a4b2b205/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0007-Fix-creation-of-temp-variables.patch
Type: text/x-diff
Size: 1482 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100524/a4b2b205/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008-Avoid-if-conversion-of-loops-in-which-the-data-depen.patch
Type: text/x-diff
Size: 1282 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100524/a4b2b205/attachment-0007.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0009-Don-t-handle-BBs-with-more-than-2-preds-or-succs.patch
Type: text/x-diff
Size: 935 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100524/a4b2b205/attachment-0008.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0010-Remove-conditions-in-the-code-generation-of-if-conve.patch
Type: text/x-diff
Size: 4826 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100524/a4b2b205/attachment-0009.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0011-Reorganize-the-analysis-of-basic-block-predication.patch
Type: text/x-diff
Size: 11624 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100524/a4b2b205/attachment-0010.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0012-Do-not-check-the-if-convertibility-of-statements-tha.patch
Type: text/x-diff
Size: 1883 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100524/a4b2b205/attachment-0011.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0013-Predicate-all-the-memory-writes.patch
Type: text/x-diff
Size: 12019 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100524/a4b2b205/attachment-0012.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0014-Do-not-check-whether-memory-references-accessed-in-e.patch
Type: text/x-diff
Size: 15049 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100524/a4b2b205/attachment-0013.bin>


More information about the Gcc-patches mailing list