mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-24 11:24:05 +08:00
re PR tree-optimization/57380 (GCC 4.9.0 will not vectorize std::max and similar functions)
2013-05-23 Richard Biener <rguenther@suse.de> PR tree-optimization/57380 * tree-ssa-phiprop.c (propagate_with_phi): Do not require at least one invariant or re-used load. * passes.c (init_optimization_passes): Move pass_phiprop before pass_forwprop. * g++.dg/tree-ssa/pr57380.C: New testcase. From-SVN: r199246
This commit is contained in:
parent
75c7257f75
commit
ce521ae644
@ -1,3 +1,11 @@
|
|||||||
|
2013-05-23 Richard Biener <rguenther@suse.de>
|
||||||
|
|
||||||
|
PR tree-optimization/57380
|
||||||
|
* tree-ssa-phiprop.c (propagate_with_phi): Do not require at
|
||||||
|
least one invariant or re-used load.
|
||||||
|
* passes.c (init_optimization_passes): Move pass_phiprop before
|
||||||
|
pass_forwprop.
|
||||||
|
|
||||||
2013-05-23 James Greenhalgh <james.greenhalgh@arm.com>
|
2013-05-23 James Greenhalgh <james.greenhalgh@arm.com>
|
||||||
|
|
||||||
* config/aarch64/aarch64-simd.md
|
* config/aarch64/aarch64-simd.md
|
||||||
|
@ -1402,12 +1402,12 @@ init_optimization_passes (void)
|
|||||||
NEXT_PASS (pass_ccp);
|
NEXT_PASS (pass_ccp);
|
||||||
/* After CCP we rewrite no longer addressed locals into SSA
|
/* After CCP we rewrite no longer addressed locals into SSA
|
||||||
form if possible. */
|
form if possible. */
|
||||||
|
NEXT_PASS (pass_phiprop);
|
||||||
NEXT_PASS (pass_forwprop);
|
NEXT_PASS (pass_forwprop);
|
||||||
/* pass_build_alias is a dummy pass that ensures that we
|
/* pass_build_alias is a dummy pass that ensures that we
|
||||||
execute TODO_rebuild_alias at this point. */
|
execute TODO_rebuild_alias at this point. */
|
||||||
NEXT_PASS (pass_build_alias);
|
NEXT_PASS (pass_build_alias);
|
||||||
NEXT_PASS (pass_return_slot);
|
NEXT_PASS (pass_return_slot);
|
||||||
NEXT_PASS (pass_phiprop);
|
|
||||||
NEXT_PASS (pass_fre);
|
NEXT_PASS (pass_fre);
|
||||||
NEXT_PASS (pass_copy_prop);
|
NEXT_PASS (pass_copy_prop);
|
||||||
NEXT_PASS (pass_merge_phi);
|
NEXT_PASS (pass_merge_phi);
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2013-05-23 Richard Biener <rguenther@suse.de>
|
||||||
|
|
||||||
|
PR tree-optimization/57380
|
||||||
|
* g++.dg/tree-ssa/pr57380.C: New testcase.
|
||||||
|
|
||||||
2013-05-23 Richard Biener <rguenther@suse.de>
|
2013-05-23 Richard Biener <rguenther@suse.de>
|
||||||
|
|
||||||
PR middle-end/57381
|
PR middle-end/57381
|
||||||
|
21
gcc/testsuite/g++.dg/tree-ssa/pr57380.C
Normal file
21
gcc/testsuite/g++.dg/tree-ssa/pr57380.C
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-O2 -fdump-tree-phiopt1" } */
|
||||||
|
|
||||||
|
struct my_array {
|
||||||
|
int data[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
const int& my_max(const int& a, const int& b) {
|
||||||
|
return a < b ? b : a;
|
||||||
|
}
|
||||||
|
|
||||||
|
int f(my_array a, my_array b) {
|
||||||
|
int res = 0;
|
||||||
|
for (int i = 0; i < 4; ++i) {
|
||||||
|
res += my_max(a.data[i], b.data[i]);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* { dg-final { scan-tree-dump "MAX_EXPR" "phiopt1" } } */
|
||||||
|
/* { dg-final { cleanup-tree-dump "phiopt1" } } */
|
@ -247,7 +247,6 @@ propagate_with_phi (basic_block bb, gimple phi, struct phiprop_d *phivn,
|
|||||||
ssa_op_iter i;
|
ssa_op_iter i;
|
||||||
bool phi_inserted;
|
bool phi_inserted;
|
||||||
tree type = NULL_TREE;
|
tree type = NULL_TREE;
|
||||||
bool one_invariant = false;
|
|
||||||
|
|
||||||
if (!POINTER_TYPE_P (TREE_TYPE (ptr))
|
if (!POINTER_TYPE_P (TREE_TYPE (ptr))
|
||||||
|| !is_gimple_reg_type (TREE_TYPE (TREE_TYPE (ptr))))
|
|| !is_gimple_reg_type (TREE_TYPE (TREE_TYPE (ptr))))
|
||||||
@ -282,17 +281,8 @@ propagate_with_phi (basic_block bb, gimple phi, struct phiprop_d *phivn,
|
|||||||
if (!type
|
if (!type
|
||||||
&& TREE_CODE (arg) == SSA_NAME)
|
&& TREE_CODE (arg) == SSA_NAME)
|
||||||
type = TREE_TYPE (phivn[SSA_NAME_VERSION (arg)].value);
|
type = TREE_TYPE (phivn[SSA_NAME_VERSION (arg)].value);
|
||||||
if (TREE_CODE (arg) == ADDR_EXPR
|
|
||||||
&& is_gimple_min_invariant (arg))
|
|
||||||
one_invariant = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we neither have an address of a decl nor can reuse a previously
|
|
||||||
inserted load, do not hoist anything. */
|
|
||||||
if (!one_invariant
|
|
||||||
&& !type)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* Find a dereferencing use. First follow (single use) ssa
|
/* Find a dereferencing use. First follow (single use) ssa
|
||||||
copy chains for ptr. */
|
copy chains for ptr. */
|
||||||
while (single_imm_use (ptr, &use, &use_stmt)
|
while (single_imm_use (ptr, &use, &use_stmt)
|
||||||
|
Loading…
Reference in New Issue
Block a user