[patch] More improvements for the code generation of the if-conversion
Sebastian Pop
sebpop@gmail.com
Wed Jun 30 01:33:00 GMT 2010
On Fri, Jun 25, 2010 at 09:48, Richard Guenther <rguenther@suse.de> wrote:
>> 0005 implements and calls an unfold SSA function that first expands
>> the SSA_NAMEs and then calls fold on the expanded expression tree.
>> unfold_ssa_names exposes to fold a more complete expression than
>> otherwise available in the predicates of a BB. This patch is now
>> needed to improve the quality of the code generated by the
>> if-conversion as if-convert gimplifies the predicates in order to
>> avoid recomputations of some predicates. With this patch it is
>> possible to fold (a || b) into the true predicate when a and b are the
>> predicates of the two branches of a condition, as the SSA_NAMEs a and
>> b are first unfolded into their respective expressions and then fold
>> finishes by computing the true predicate. Note that this patch needs
>> some adjustment, i.e., replacing the magic constant 5 that is the
>> depth level for the unfold traversal to be some parameter, or so.
>
> + op2 = unfold_ssa_names (gimple_assign_rhs2 (stmt), level);
>
> this possibly accesses uninitialized and unallocated memory.
How could this happen, could you explain?
> I do not think this patch is a good idea at all and you allow
> exponential growth as you do not decrement level for each operand
> you visit. Thus, for all-ternary operands and your use of a limit
> of depth 5 you'd get 243 substitutions and foldings.
>
> At most a substitution depth of 1 would be which in turn will
> simplify that patch a lot.
A substitution of depth 1 doesn't seem to be enough: if I am limiting
the level to 1, then with my current patch-set, I get all these failures:
FAIL: gcc.dg/vect/vect-ifcvt-16.c scan-tree-dump-times vect
"vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-ifcvt-17.c scan-tree-dump-times vect
"vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-ifcvt-2.c scan-tree-dump-times vect "vectorized
1 loops" 1
FAIL: gcc.dg/vect/vect-ifcvt-3.c scan-tree-dump-times vect "vectorized
1 loops" 1
FAIL: gcc.dg/vect/vect-ifcvt-4.c scan-tree-dump-times vect "vectorized
1 loops" 1
FAIL: gcc.dg/vect/vect-ifcvt-5.c scan-tree-dump-times vect "vectorized
1 loops" 1
FAIL: gcc.dg/vect/vect-ifcvt-6.c scan-tree-dump-times vect "vectorized
1 loops" 1
FAIL: gcc.dg/vect/vect-ifcvt-7.c scan-tree-dump-times vect "vectorized
1 loops" 1
FAIL: gcc.dg/vect/vect-ifcvt-9.c scan-tree-dump-times vect "vectorized
1 loops" 2
FAIL: gcc.dg/vect/no-trapping-math-2.c scan-tree-dump-times vect
"vectorized 1 loops" 1
FAIL: gcc.dg/vect/no-trapping-math-vect-111.c scan-tree-dump-times
vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/no-trapping-math-vect-ifcvt-11.c
scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/no-trapping-math-vect-ifcvt-12.c
scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/no-trapping-math-vect-ifcvt-13.c
scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/no-trapping-math-vect-ifcvt-14.c
scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/no-trapping-math-vect-ifcvt-15.c
scan-tree-dump-times vect "vectorized 1 loops" 1
for level = 2, I still get these fails:
FAIL: gcc.dg/vect/vect-ifcvt-16.c scan-tree-dump-times vect
"vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-ifcvt-17.c scan-tree-dump-times vect
"vectorized 1 loops" 1
for level = 3 these fails disappear.
Sebastian
More information about the Gcc-patches
mailing list