Commit 9b71b2ab by Kyrylo Tkachov Committed by Kyrylo Tkachov

[RTL-ifcvt] PR rtl-optimization/68435 Allow (c ? x++ : x--) form

	PR rtl-optimization/68435
	* ifcvt.c (noce_try_cmove_arith): Skip final insn when checking
	for conflicts between a, b and the set destinations.

	* gcc.dg/pr68435.c: New test.

From-SVN: r230859
parent 514c0e7c
2015-11-25 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR rtl-optimization/68435
* ifcvt.c (noce_try_cmove_arith): Skip final insn when checking
for conflicts between a, b and the set destinations.
2015-11-25 Richard Biener <rguenther@suse.de>
PR tree-optimization/68517
......@@ -2180,7 +2180,10 @@ noce_try_cmove_arith (struct noce_if_info *if_info)
if (tmp_b && then_bb)
{
FOR_BB_INSNS (then_bb, tmp_insn)
if (modified_in_p (orig_b, tmp_insn))
/* Don't check inside insn_a. We will have changed it to emit_a
with a destination that doesn't conflict. */
if (!(insn_a && tmp_insn == insn_a)
&& modified_in_p (orig_b, tmp_insn))
{
modified_in_a = true;
break;
......@@ -2193,7 +2196,10 @@ noce_try_cmove_arith (struct noce_if_info *if_info)
if (tmp_b && else_bb)
{
FOR_BB_INSNS (else_bb, tmp_insn)
if (modified_in_p (orig_a, tmp_insn))
/* Don't check inside insn_b. We will have changed it to emit_b
with a destination that doesn't conflict. */
if (!(insn_b && tmp_insn == insn_b)
&& modified_in_p (orig_a, tmp_insn))
{
modified_in_b = true;
break;
......
2015-11-25 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR rtl-optimization/68435
* gcc.dg/pr68435.c: New test.
2015-11-25 Richard Biener <rguenther@suse.de>
PR tree-optimization/68517
......
/* { dg-do compile { target aarch64*-*-* x86_64-*-* } } */
/* { dg-options "-fdump-rtl-ce1 -O2 -w" } */
typedef struct cpp_reader cpp_reader;
enum cpp_ttype
{
CPP_EQ =
0, CPP_NOT, CPP_GREATER, CPP_LESS, CPP_PLUS, CPP_MINUS, CPP_MULT, CPP_DIV,
CPP_MOD, CPP_AND, CPP_OR, CPP_XOR, CPP_RSHIFT, CPP_LSHIFT, CPP_MIN,
CPP_MAX, CPP_COMPL, CPP_AND_AND, CPP_OR_OR, CPP_QUERY, CPP_COLON,
CPP_COMMA, CPP_OPEN_PAREN, CPP_CLOSE_PAREN, CPP_EQ_EQ, CPP_NOT_EQ,
CPP_GREATER_EQ, CPP_LESS_EQ, CPP_PLUS_EQ, CPP_MINUS_EQ, CPP_MULT_EQ,
CPP_DIV_EQ, CPP_MOD_EQ, CPP_AND_EQ, CPP_OR_EQ, CPP_XOR_EQ, CPP_RSHIFT_EQ,
CPP_LSHIFT_EQ, CPP_MIN_EQ, CPP_MAX_EQ, CPP_HASH, CPP_PASTE,
CPP_OPEN_SQUARE, CPP_CLOSE_SQUARE, CPP_OPEN_BRACE, CPP_CLOSE_BRACE,
CPP_SEMICOLON, CPP_ELLIPSIS, CPP_PLUS_PLUS, CPP_MINUS_MINUS, CPP_DEREF,
CPP_DOT, CPP_SCOPE, CPP_DEREF_STAR, CPP_DOT_STAR, CPP_ATSIGN, CPP_NAME,
CPP_NUMBER, CPP_CHAR, CPP_WCHAR, CPP_OTHER, CPP_STRING, CPP_WSTRING,
CPP_HEADER_NAME, CPP_COMMENT, CPP_MACRO_ARG, CPP_PADDING, CPP_EOF,
};
static struct op lex (cpp_reader *, int);
struct op
{
enum cpp_ttype op;
long value;
};
int
_cpp_parse_expr (pfile)
{
struct op init_stack[20];
struct op *stack = init_stack;
struct op *top = stack + 1;
int skip_evaluation = 0;
for (;;)
{
struct op op;
op = lex (pfile, skip_evaluation);
switch (op.op)
{
case CPP_OR_OR:
if (top->value)
skip_evaluation++;
else
skip_evaluation--;
}
}
}
/* { dg-final { scan-rtl-dump "2 true changes made" "ce1" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment