Commit 14d62813 by Jeff Law Committed by Jeff Law

tree-ssa-dom.c (edge_info::record_simple_equiv): Call derive_equivalences.

	* tree-ssa-dom.c (edge_info::record_simple_equiv): Call
	derive_equivalences.
	(derive_equivalences_from_bit_ior, record_temporary_equivalences):
	Code moved into....
	(edge_info::derive_equivalences): New private member function

	* gcc.dg/torture/pr57214.c: Fix type of loop counter.
	* gcc.dg/tree-ssa/ssa-sink-16.c: Disable DOM.
	* gcc.dg/tree-ssa/ssa-dom-thread-11.c: New test.
	* gcc.dg/tree-ssa/ssa-dom-thread-12.c: New test.
	* gcc.dg/tree-ssa/ssa-dom-thread-13.c: New test.
	* gcc.dg/tree-ssa/ssa-dom-thread-14.c: New test.
	* gcc.dg/tree-ssa/ssa-dom-thread-15.c: New test.
	* gcc.dg/tree-ssa/ssa-dom-thread-16.c: New test.
	* gcc.dg/tree-ssa/ssa-dom-thread-17.c: New test.

From-SVN: r251397
parent a09f784a
2017-08-28 Jeff Law <law@redhat.com>
* tree-ssa-dom.c (edge_info::record_simple_equiv): Call
derive_equivalences.
(derive_equivalences_from_bit_ior, record_temporary_equivalences):
Code moved into....
(edge_info::derive_equivalences): New private member function
* tree-ssa-dom.c (class edge_info): Changed from a struct
to a class. Add ctor/dtor, methods and data members.
(edge_info::edge_info): Renamed from allocate_edge_info.
......
2017-08-28 Jeff Law <law@redhat.com>
* gcc.dg/torture/pr57214.c: Fix type of loop counter.
* gcc.dg/tree-ssa/ssa-sink-16.c: Disable DOM.
* gcc.dg/tree-ssa/ssa-dom-thread-11.c: New test.
* gcc.dg/tree-ssa/ssa-dom-thread-12.c: New test.
* gcc.dg/tree-ssa/ssa-dom-thread-13.c: New test.
* gcc.dg/tree-ssa/ssa-dom-thread-14.c: New test.
* gcc.dg/tree-ssa/ssa-dom-thread-15.c: New test.
* gcc.dg/tree-ssa/ssa-dom-thread-16.c: New test.
* gcc.dg/tree-ssa/ssa-dom-thread-17.c: New test.
2017-08-28 Janus Weil <janus@gcc.gnu.org>
PR fortran/81770
......
......@@ -15,7 +15,7 @@ bar (_Bool b)
b = 1;
baz ();
x = 0;
int i;
unsigned int i;
while (buf[i] && i)
i++;
foo ();
......
/* { dg-do compile { target { ! logical_op_short_circuit } } } */
/* { dg-options "-O2 -fdump-tree-dom2-details" } */
static int *bb_ticks;
extern void frob (void);
void
mark_target_live_regs (int b, int block, int bb_tick)
{
if (b == block && b != -1 && bb_tick == bb_ticks[b])
return;
if (b != -1)
frob ();
}
/* When the first two conditionals in the first IF are true, but
the third conditional is false, then there's a jump threading
opportunity to bypass the second IF statement. */
/* { dg-final { scan-tree-dump-times "Threaded" 1 "dom2"} } */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-dom2-details -w" } */
typedef long unsigned int size_t;
union tree_node;
typedef union tree_node *tree;
typedef union gimple_statement_d *gimple;
typedef const union gimple_statement_d *const_gimple;
union gimple_statement_d
{
unsigned num_ops;
tree exp;
};
unsigned int x;
static inline tree
gimple_op (const_gimple gs, unsigned i)
{
if (!(i < gs->num_ops))
abort ();
return gs->exp;
}
unsigned char
scan_function (gimple stmt)
{
unsigned i;
for (i = 0; i < stmt->num_ops - 3 ; i++)
gimple_call_arg (stmt, i);
gimple_op (stmt, 1);
}
/* The test which bypasses the loop is simplified prior to DOM to check
that stmt->num_ops - 3 != 0. When that test is false, we can derive
a value for stmt->num_ops. That in turn allows us to thread the jump
for the conditional at the start of the call to gimple_op. */
/* { dg-final { scan-tree-dump-times "Threaded" 1 "dom2"} } */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-dom2-details -w" } */
union tree_node;
typedef union tree_node *tree;
extern unsigned char tree_contains_struct[0xdead][64];
struct tree_base
{
int code:16;
};
struct tree_typed
{
tree type;
};
struct tree_type_common
{
tree main_variant;
};
extern tree build_target_option_node (void);
union tree_node
{
struct tree_base base;
struct tree_typed typed;
struct tree_type_common type_common;
};
tree
convert (tree type, tree expr)
{
tree e = expr;
int code = (type)->base.code;
const char *invalid_conv_diag;
tree ret;
if (tree_contains_struct[expr->base.code][(42)] != 1)
abort ();
if (type->type_common.main_variant == expr->typed.type->type_common.main_variant
&& (expr->typed.type->base.code != 123
|| e->base.code == 456))
return arf ();
if (expr->typed.type->base.code == 42)
error ("void value not ignored as it ought to be");
}
/* When the *->base.code tests in the second IF statement are false, we
know that expr->typed.base->base.code has the value 123. That allows
us to thread the test for the final IF statement on that path. */
/* { dg-final { scan-tree-dump-times "Threaded" 1 "dom2"} } */
/* { dg-do compile { target { ! logical_op_short_circuit } } } */
/* { dg-options "-O2 -fdump-tree-dom2-details -w" } */
enum optab_methods
{
OPTAB_DIRECT,
OPTAB_LIB,
OPTAB_WIDEN,
OPTAB_LIB_WIDEN,
OPTAB_MUST_WIDEN
};
struct optab_d { };
typedef struct optab_d *optab;
void
expand_shift_1 (int code, int unsignedp, int rotate,
optab lshift_optab, optab rshift_arith_optab)
{
int left = (code == 42 || code == 0xde);
int attempt;
enum optab_methods methods;
if (attempt == 0)
methods = OPTAB_DIRECT;
else if (attempt == 1)
methods = OPTAB_WIDEN;
if ((!unsignedp || (!left && methods == OPTAB_WIDEN)))
{
enum optab_methods methods1 = methods;
if (unsignedp)
methods1 = OPTAB_MUST_WIDEN;
expand_binop (left ? lshift_optab : rshift_arith_optab,
unsignedp, methods1);
}
}
/* When UNSIGNEDP is true, LEFT is false and METHOD == OPTAB_WIDEN
we will enter the TRUE arm of the conditional and we can thread
the test to compute the first first argument of the expand_binop
call if we look backwards through the boolean logicals. */
/* { dg-final { scan-tree-dump-times "Threaded" 1 "dom2"} } */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-dom2-details -w" } */
struct rtx_def;
typedef struct rtx_def *rtx;
struct machine_frame_state
{
rtx cfa_reg;
long sp_offset;
};
struct machine_function {
struct machine_frame_state fs;
};
enum global_rtl_index
{
GR_PC,
GR_CC0,
GR_RETURN,
GR_SIMPLE_RETURN,
GR_STACK_POINTER,
GR_FRAME_POINTER,
GR_HARD_FRAME_POINTER,
GR_ARG_POINTER,
GR_VIRTUAL_INCOMING_ARGS,
GR_VIRTUAL_STACK_ARGS,
GR_VIRTUAL_STACK_DYNAMIC,
GR_VIRTUAL_OUTGOING_ARGS,
GR_VIRTUAL_CFA,
GR_VIRTUAL_PREFERRED_STACK_BOUNDARY,
GR_MAX
};
struct target_rtl {
rtx x_global_rtl[GR_MAX];
};
extern struct target_rtl default_target_rtl;
struct function {
struct machine_function * machine;
};
extern struct function *cfun;
struct ix86_frame
{
long stack_pointer_offset;
};
void
ix86_expand_prologue (void)
{
struct machine_function *m = (cfun + 0)->machine;
struct ix86_frame frame;
long allocate;
allocate = frame.stack_pointer_offset - m->fs.sp_offset;
if (allocate == 0)
;
else if (!ix86_target_stack_probe ())
{
pro_epilogue_adjust_stack ((((&default_target_rtl)->x_global_rtl)[GR_STACK_POINTER]), (((&default_target_rtl)->x_global_rtl)[GR_STACK_POINTER]),
gen_rtx_CONST_INT ((-allocate)), -1,
m->fs.cfa_reg == (((&default_target_rtl)->x_global_rtl)[GR_STACK_POINTER]));
}
((void)(!(m->fs.sp_offset == frame.stack_pointer_offset) ? fancy_abort ("../../gcc-4.7.3/gcc/config/i386/i386.c", 10435, __FUNCTION__), 0 : 0));
}
/* In the case where ALLOCATE is zero, we know that sp_offset and
stack_poitner_offset within their respective structures are the
same. That allows us to thread the jump from the true arm of the
first IF conditional around the test controlling the call to
fancy_abort. */
/* { dg-final { scan-tree-dump-times "Threaded" 1 "dom2"} } */
/* { dg-do compile { target { ! logical_op_short_circuit } } } */
/* { dg-options "-O2 -fdump-tree-dom2-details -w" } */
unsigned char
validate_subreg (unsigned int offset, unsigned int isize, unsigned int osize, int zz, int qq)
{
if (osize >= (((zz & (1L << 2)) != 0) ? 8 : 4) && isize >= osize)
;
else if (qq == 99)
return 0;
if (osize > isize)
return offset == 0;
return 1;
}
/* When we test isize >= osize in the first IF conditional and it is
false and qq != 99, then we can thread the osize > isize test of
the second conditional. */
/* { dg-final { scan-tree-dump-times "Threaded" 1 "dom2"} } */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-dom2 -w" } */
struct rtx_def;
typedef struct rtx_def *rtx;
struct reload
{
rtx in;
rtx reg_rtx;
};
extern struct reload rld[(2 * 30 * (2 + 1))];
static rtx find_dummy_reload (rtx);
extern int frob ();
extern int arf ();
int
push_reload (rtx in, rtx out
)
{
int i;
if (out != 0 && in != out)
{
rld[i].reg_rtx = find_dummy_reload (out);
if (rld[i].reg_rtx == out)
rld[i].in = out;
}
}
rtx
find_dummy_reload (rtx real_out)
{
unsigned int nwords = frob ();
unsigned int regno = frob ();
unsigned int i;
for (i = 0; i < nwords; i++)
if (arf ())
break;
if (i == nwords)
return real_out;
return 0;
}
/* In the case where the call to find_dummy_reload returns 0,
the final test in push_reload will never be true and it will
be eliminated. */
/* { dg-final { scan-tree-dump-not "out_\[^\n\r]+ == 0" "dom2"} } */
/* { dg-do compile } */
/* Note PRE rotates the loop and blocks the sinking opportunity. */
/* { dg-options "-O2 -fno-tree-pre -fdump-tree-sink -fdump-tree-optimized" } */
/* Note PRE and DOM jump threading rotate the loop and blocks the sinking opportunity. */
/* { dg-options "-O2 -fno-tree-pre -fno-tree-dominator-opts -fdump-tree-sink -fdump-tree-optimized" } */
int f(int n)
{
......
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