[patch] if-conversion of loops with conditionals containing memory loads and stores

Sebastian Pop sebpop@gmail.com
Wed Jun 30 18:01:00 GMT 2010


On Wed, Jun 30, 2010 at 11:57, Jeff Law <law@redhat.com> wrote:
> On 06/23/10 11:23, Sebastian Pop wrote:
>>
>> On Wed, Jun 23, 2010 at 11:28, Jeff Law<law@redhat.com>  wrote:
>>
>>>
>>> On 06/22/10 14:17, Sebastian Pop wrote:
>>>
>>>>
>>>> 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.
>>>>
>>>>
>>>
>>> Doesn't this run afoul of the C++0x memory model?
>>>
>>>
>>
>> This still does fit in the -fmemory-model=single as discussed in
>> http://gcc.gnu.org/ml/gcc/2010-05/msg00171.html
>>
>
> Agreed.
>
>> I could add a separate flag for this transformation, such that it will
>> be easier to separate it from the rest of the tree-if-conversion pass
>> when implementing the -fmemory-model flag.
>>
>
> Probably wise.  Or at least something that makes it very easy to find this
> transformation so that we can disable it as needed for the different
> -fmemory-model options.
>

What about -ftree-if-convert-memory-writes?

Also, I see that the tree-if-conversion does not have a flag to
enable/disable it:

static bool
gate_tree_if_conversion (void)
{
  return flag_tree_vectorize != 0;
}

What about also adding and documenting the -ftree-if-convert flag?

Thanks,
Sebastian



More information about the Gcc-patches mailing list