remove sel_based_null_check flag
authorMatthias Braun <matze@braunis.de>
Fri, 18 Nov 2011 13:22:09 +0000 (14:22 +0100)
committerMatthias Braun <matze@braunis.de>
Fri, 18 Nov 2011 16:54:48 +0000 (17:54 +0100)
We simply always assume that Sel can only return a null pointer if
its input is a null pointer.

include/libfirm/irflag.h
ir/ir/irflag_t.def
ir/opt/opt_confirms.c
scripts/ir_spec.py

index e32d868..730c560 100644 (file)
@@ -118,24 +118,6 @@ FIRM_API int get_opt_suppress_downcast_optimization(void);
  */
 FIRM_API void set_opt_ldst_only_null_ptr_exceptions(int value);
 
-/**
- * Enable/Disable Selection based Null pointer check elimination.
- *
- * In languages, where all addresses are always Sel nodes, Null
- * pointers can only occur as input to Sel nodes.
- * If Null pointers are the only source for exceptions in Load and
- * Store nodes (as typical in high level languages), we can eliminate
- * exception edges from Load and Store when can prove that the Sel
- * nodes representing the Load/Store address have non-null inputs.
- * Enabling this flag enables this elimination.
- *
- * Enabling this flag is meaningless if ldst_non_null_exceptions is
- * enabled.
- *
- * This flag should be set for Java style languages.
- */
-FIRM_API void set_opt_sel_based_null_check_elim(int value);
-
 /**
  * Enable/Disable Global Null Pointer Test Elimination.
  *
index b22823e..2f8ca50 100644 (file)
@@ -57,9 +57,6 @@ E_FLAG(suppress_downcast_optimization     , 7, OFF)
 /** Load and Store have only Null exceptions. */
 I_FLAG(ldst_only_null_ptr_exceptions      , 8, ON)
 
-/** Sel-based Null-pointer check elimination. */
-I_FLAG(sel_based_null_check_elim          , 9, OFF)
-
 /** Automatically create Sync node during construction. */
 I_FLAG(auto_create_sync                   , 10, OFF)
 
index 611ee19..99c6183 100644 (file)
@@ -167,9 +167,7 @@ FIRM_API int value_not_zero(const ir_node *n, ir_node_cnst_ptr *confirm)
 /*
  * Check, if the value of a node cannot represent a NULL pointer.
  *
- * - Casts are skipped
- * - If sel_based_null_check_elim is enabled, all
- *   Sel nodes can be skipped.
+ * - Casts are skipped, Sels are skipped
  * - A SymConst(entity) is NEVER a NULL pointer
  * - Confirms are evaluated
  */
@@ -185,11 +183,9 @@ FIRM_API int value_not_null(const ir_node *n, ir_node_cnst_ptr *confirm)
                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 (is_Sel(n)) {
-                       n = skip_Cast(get_Sel_ptr(n));
-               }
+       /* skip all Sel nodes and Cast's */
+       while (is_Sel(n)) {
+               n = skip_Cast(get_Sel_ptr(n));
        }
        while (1) {
                if (is_Cast(n)) { n = get_Cast_op(n); continue; }
index ec8b6a7..489cd40 100755 (executable)
@@ -782,7 +782,10 @@ class Rotl(Binop):
 
 class Sel(Op):
        """Computes the address of a entity of a compound type given the base
-       address of an instance of the compound type."""
+       address of an instance of the compound type.
+
+       Optimisations assume that a Sel node can only produce a NULL pointer if the
+       ptr input was NULL."""
        ins    = [
                ("mem", "memory dependency"),
                ("ptr", "pointer to object to select from"),