re PR rtl-optimization/31691 (optimized code taking the wrong branch)

PR rtl-optimization/31691
	* combine.c (simplify_set): Build a new src pattern instead of
	substituting its operands in the COMPARE case.

From-SVN: r124797
This commit is contained in:
Eric Botcazou 2007-05-17 15:29:10 +02:00 committed by Eric Botcazou
parent 0881653ce2
commit 4eff80454b
4 changed files with 56 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2007-05-17 Eric Botcazou <ebotcazou@libertysurf.fr>
PR rtl-optimization/31691
* combine.c (simplify_set): Build a new src pattern instead of
substituting its operands in the COMPARE case.
2007-05-17 Zdenek Dvorak <dvorakz@suse.cz>
* tree-vrp.c (finalize_jump_threads): Do not care about dominance info.

View File

@ -5343,14 +5343,14 @@ simplify_set (rtx x)
}
else if (GET_MODE (op0) == compare_mode && op1 == const0_rtx)
{
SUBST(SET_SRC (x), op0);
SUBST (SET_SRC (x), op0);
src = SET_SRC (x);
}
else
/* Otherwise, update the COMPARE if needed. */
else if (XEXP (src, 0) != op0 || XEXP (src, 1) != op1)
{
/* Otherwise, update the COMPARE if needed. */
SUBST (XEXP (src, 0), op0);
SUBST (XEXP (src, 1), op1);
SUBST (SET_SRC (x), gen_rtx_COMPARE (compare_mode, op0, op1));
src = SET_SRC (x);
}
}
else

View File

@ -1,3 +1,7 @@
2007-05-17 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.c-torture/execute/20070517-1.c: New test.
2007-05-17 Daniel Franke <franke.daniel@gmail.com>
PR fortran/31919

View File

@ -0,0 +1,41 @@
/* PR rtl-optimization/31691 */
/* Origin: Chi-Hua Chen <stephaniechc-gccbug@yahoo.com> */
extern void abort (void);
static int get_kind(int) __attribute__ ((noinline));
static int get_kind(int v)
{
volatile int k = v;
return k;
}
static int some_call(void) __attribute__ ((noinline));
static int some_call(void)
{
return 0;
}
static void example (int arg)
{
int tmp, kind = get_kind (arg);
if (kind == 9 || kind == 10 || kind == 5)
{
if (some_call() == 0)
{
if (kind == 9 || kind == 10)
tmp = arg;
else
abort();
}
}
}
int main(void)
{
example(10);
return 0;
}