aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-match-head.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2018-10-08 22:47:32 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2018-10-08 22:47:32 +0000
commitde3101937e73a9a46d62aad616d969fc7da66070 (patch)
tree55a2eadb0e412c74af6fb377fc0bc4509b62c233 /gcc/gimple-match-head.c
parent91a3cbb4d20c3486ee38233f5864c3625692ea80 (diff)
downloadgcc-de3101937e73a9a46d62aad616d969fc7da66070.zip
gcc-de3101937e73a9a46d62aad616d969fc7da66070.tar.gz
gcc-de3101937e73a9a46d62aad616d969fc7da66070.tar.bz2
re PR tree-optimization/86659 (gnat.dg/sso/q[23].adb FAIL)
PR tree-optimization/86659 * gimple-match.h (struct gimple_match_op): Add reverse field. (gimple_match_op::set_op): New overloaded method. * gimple-match-head.c (maybe_build_generic_op) <BIT_FIELD_REF>: Set the REF_REVERSE_STORAGE_ORDER flag on the value. (gimple_simplify) <GIMPLE_ASSIGN>: For BIT_FIELD_REF, propagate the REF_REVERSE_STORAGE_ORDER flag and avoid simplifying if it is set. From-SVN: r264942
Diffstat (limited to 'gcc/gimple-match-head.c')
-rw-r--r--gcc/gimple-match-head.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/gimple-match-head.c b/gcc/gimple-match-head.c
index 414007e..d6c60ab 100644
--- a/gcc/gimple-match-head.c
+++ b/gcc/gimple-match-head.c
@@ -445,16 +445,20 @@ void
maybe_build_generic_op (gimple_match_op *res_op)
{
tree_code code = (tree_code) res_op->code;
+ tree val;
switch (code)
{
case REALPART_EXPR:
case IMAGPART_EXPR:
case VIEW_CONVERT_EXPR:
- res_op->set_value (build1 (code, res_op->type, res_op->ops[0]));
+ val = build1 (code, res_op->type, res_op->ops[0]);
+ res_op->set_value (val);
break;
case BIT_FIELD_REF:
- res_op->set_value (build3 (code, res_op->type, res_op->ops[0],
- res_op->ops[1], res_op->ops[2]));
+ val = build3 (code, res_op->type, res_op->ops[0], res_op->ops[1],
+ res_op->ops[2]);
+ REF_REVERSE_STORAGE_ORDER (val) = res_op->reverse;
+ res_op->set_value (val);
break;
default:;
}
@@ -853,7 +857,10 @@ gimple_simplify (gimple *stmt, gimple_match_op *res_op, gimple_seq *seq,
op0 = do_valueize (op0, top_valueize, valueized);
res_op->set_op (code, type, op0,
TREE_OPERAND (rhs1, 1),
- TREE_OPERAND (rhs1, 2));
+ TREE_OPERAND (rhs1, 2),
+ REF_REVERSE_STORAGE_ORDER (rhs1));
+ if (res_op->reverse)
+ return valueized;
return (gimple_resimplify3 (seq, res_op, valueize)
|| valueized);
}