[patch] if-conversion of loops with conditionals containing memory loads and stores
Sebastian Pop
sebpop@gmail.com
Tue Jun 22 23:37:00 GMT 2010
Hi,
The attached patches (on top of the previous patch set) are needed to
if-convert the DCT loop kernel of FFmpeg.
0009 replaces the memory writes that are in predicated basic blocks
with a full write: "if (cond) A[i] = foo" is replaced with "A[i] =
cond ? foo : A[i]". In order to do this, the patch replaces the call
to gimple_assign_rhs_could_trap_p with gimple_could_trap_p, as we now
have to check that the LHS of assign stmts in conditions do not trap.
In order to if-convert the DCT kernel:
for (i = 0; i <= nCoeffs; i++)
{
level = block[i];
if (level)
{
if (level < 0)
{
level = level * qmul - qadd;
}
else
{
level = level * qmul + qadd;
}
block[i] = level;
}
}
0010 proves that the accesses to an array in a loop do not trap (more
(than the original non-if-converted loop)) if they are executed at
every iteration. In this DCT kernel, the read into block[i] happens
at every iteration, and thus the if-converted writes into block[i]
will not trap more than the original code.
The attached patches are the same as previously posted, with the
exception of this part from 0009:
(if_convertible_gimple_assign_stmt_p): Do not handle types that do
not match is_gimple_reg_type.
+ if (!is_gimple_reg_type (TREE_TYPE (lhs)))
+ return false;
+
this makes the patch pass with the extra checks added by Richi to
avoid operands of the COND_EXPR to contain memory loads or stores.
These two patches passed regstrap with BOOT_CFLAGS= -g -O3 -msse2 on
amd64-linux on top of the 8 other patches submitted separately.
Ok for trunk?
Thanks,
Sebastian Pop
--
AMD / Open Source Compiler Engineering / GNU Tools
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0009-Predicate-all-the-memory-writes.patch
Type: text/x-patch
Size: 14047 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100622/44927efa/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0010-Do-not-check-whether-memory-references-accessed-in-e.patch
Type: text/x-patch
Size: 14746 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100622/44927efa/attachment-0001.bin>
More information about the Gcc-patches
mailing list