Commit f4cc11ac authored by Michael Beck's avatar Michael Beck
Browse files

revised equivalent_node() functions:

 - use value_of() instead of is_Const() tests to allow interaction with combo
 - new nodes in equivalent_node are NOT allowed
 - turn_into_tuple() in equivalent_node is NOT allowed
 - do NOT allow equivalent nodes for mode_T nodes!

BugFix:
 - value_not_null() checked for wrong pnc

[r20946]
parent 1866890b
......@@ -111,6 +111,7 @@ enum firmstat_optimizations_t {
FS_OPT_CMP_CNST_MAGN, /**< CMP optimization: reduced magnitude of a const */
FS_OPT_CMP_SHF_TO_AND, /**< CMP optimization: transformed shift into And */
FS_OPT_CMP_MOD_TO_AND, /**< CMP optimization: transformed Mod into And */
FS_OPT_NOP, /**< the operation is a NOP */
FS_OPT_RTS_ABS, /**< RTS optimization: call to abs() replaced */
FS_OPT_RTS_ALLOCA, /**< RTS optimization: call to alloca() replaced */
FS_OPT_RTS_SQRT, /**< RTS optimization: call to sqrt() replaced */
......
This diff is collapsed.
......@@ -176,18 +176,20 @@ int value_not_zero(ir_node *n, ir_node **confirm) {
* - Confirms are evaluated
*/
int value_not_null(ir_node *n, ir_node **confirm) {
ir_op *op;
tarval *tv;
*confirm = NULL;
n = skip_Cast(n);
op = get_irn_op(n);
tv = value_of(n);
if (tarval_is_constant(tv) && ! tarval_is_null(tv))
return 1;
assert(mode_is_reference(get_irn_mode(n)));
if (get_opt_sel_based_null_check_elim()) {
/* skip all Sel nodes and Cast's */
while (op == op_Sel) {
while (is_Sel(n)) {
n = skip_Cast(get_Sel_ptr(n));
op = get_irn_op(n);
}
}
if (is_Global(n)) {
......@@ -196,15 +198,14 @@ int value_not_null(ir_node *n, ir_node **confirm) {
} else if (n == get_irg_frame(current_ir_graph)) {
/* local references are never NULL */
return 1;
} else if (op == op_Const) {
/* explicit non-NULL addresses */
return !is_Const_null(n);
} else {
/* check for more Confirms */
for (; is_Confirm(n); n = skip_Cast(get_Confirm_value(n))) {
if (get_Confirm_cmp(n) != pn_Cmp_Lg) {
if (get_Confirm_cmp(n) == pn_Cmp_Lg) {
ir_node *bound = get_Confirm_bound(n);
if (is_Const(bound) && is_Const_null(bound)) {
tarval *tv = value_of(bound);
if (tarval_is_null(tv)) {
*confirm = n;
return 1;
}
......
......@@ -129,6 +129,7 @@ static const struct {
{ FS_OPT_CMP_CNST_MAGN, "CMP optimization: reduced magnitude of a const" },
{ FS_OPT_CMP_SHF_TO_AND, "CMP optimization: transformed shift into And" },
{ FS_OPT_CMP_MOD_TO_AND, "CMP optimization: transformed Mod into And" },
{ FS_OPT_NOP, "the operation is a NOP" },
{ FS_OPT_RTS_ABS, "RTS optimization: call to abs() replaced" },
{ FS_OPT_RTS_ALLOCA, "RTS optimization: call to alloca() replaced" },
{ FS_OPT_RTS_SQRT, "RTS optimization: call to sqrt() replaced" },
......
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