[gcc(refs/users/aldyh/heads/ranger-staging)] Comment police.

Aldy Hernandez aldyh@gcc.gnu.org
Wed Sep 30 08:46:28 GMT 2020


https://gcc.gnu.org/g:17b1619f7cfaf3c3c6430bd772fef268f10e402f

commit 17b1619f7cfaf3c3c6430bd772fef268f10e402f
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Wed Sep 30 09:26:48 2020 +0200

    Comment police.

Diff:
---
 gcc/gimple-range-cache.cc    | 60 +++++++++++++++++------------------
 gcc/gimple-range-edge.cc     | 13 ++++----
 gcc/gimple-range-edge.h      |  6 ++--
 gcc/gimple-range-gori.cc     | 75 +++++++++++++++++++++++---------------------
 gcc/gimple-range-gori.h      | 28 ++++++++---------
 gcc/gimple-range.cc          | 49 +++++++++--------------------
 gcc/gimple-range.h           |  2 +-
 gcc/gimple-ssa-evrp.c        |  9 +++---
 gcc/gimple-ssa-warn-alloca.c |  2 +-
 9 files changed, 113 insertions(+), 131 deletions(-)

diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
index bb771de0709..a279dfb9c42 100644
--- a/gcc/gimple-range-cache.cc
+++ b/gcc/gimple-range-cache.cc
@@ -139,7 +139,7 @@ private:
 };
 
 
-// Initialize a block cache for an ssa_name of type T
+// Initialize a block cache for an ssa_name of type T.
 
 ssa_block_ranges::ssa_block_ranges (tree t, irange_pool *pool)
 {
@@ -181,7 +181,7 @@ ssa_block_ranges::set_bb_varying (const basic_block bb)
   m_tab[bb->index] = m_type_range;
 }
 
-// Return the range associated with block BB in R. Return false if
+// Return the range associated with block BB in R.  Return false if
 // there is no range.
 
 bool
@@ -196,7 +196,7 @@ ssa_block_ranges::get_bb_range (irange &r, const basic_block bb)
   return false;
 }
 
-// Returns true if a range is present
+// Return true if a range is present.
 
 bool
 ssa_block_ranges::bb_range_p (const basic_block bb)
@@ -248,7 +248,7 @@ block_range_cache::~block_range_cache ()
   m_ssa_ranges.release ();
 }
 
-// Return a reference to the m_block_cache for NAME. If it has not been
+// Return a reference to the m_block_cache for NAME.  If it has not been
 // accessed yet, allocate it.
 
 ssa_block_ranges &
@@ -273,7 +273,7 @@ block_range_cache::set_bb_range (tree name, const basic_block bb,
   return get_block_ranges (name).set_bb_range (bb, r);
 }
 
-// Set the range for NAME on entry to block BB to varying..
+// Set the range for NAME on entry to block BB to varying.
 
 void
 block_range_cache::set_bb_varying (tree name, const basic_block bb)
@@ -281,7 +281,7 @@ block_range_cache::set_bb_varying (tree name, const basic_block bb)
   return get_block_ranges (name).set_bb_varying (bb);
 }
 
-// Return the range for NAME on entry to BB in R.  Return true if here
+// Return the range for NAME on entry to BB in R.  Return true if there
 // is one.
 
 bool
@@ -362,6 +362,7 @@ block_range_cache::dump (FILE *f, basic_block bb, bool print_varying)
       fprintf (f, "\n");
     }
 }
+
 // -------------------------------------------------------------------------
 
 // Initialize a global cache.
@@ -478,14 +479,14 @@ ranger_cache::~ranger_cache ()
 #define DEBUG_CACHE (dump_file && flag_evrp_mode == EVRP_MODE_RVRP_DEBUG)
 
 // Push a request for a new lookup in block BB of name.  Return true if
-// the requiest is actually made (ie, isn't a duplicate)
+// the request is actually made (ie, isn't a duplicate).
 
 bool
 ranger_cache::push_poor_value (basic_block bb, tree name)
 {
   if (m_poor_value_list.length ())
     {
-      // Don't push anything else to the same block.  IF there are multiple 
+      // Don't push anything else to the same block.  If there are multiple 
       // things required, another request will come during a later evaluation
       // and this prevents oscillation building uneccessary depth.
       if ((m_poor_value_list.last ()).bb == bb)
@@ -500,7 +501,7 @@ ranger_cache::push_poor_value (basic_block bb, tree name)
 }
 
 //  Provide lookup for the gori-computes class to access the best known range
-//  of an ssa_name in any given basic block.  Note this does no additonal
+//  of an ssa_name in any given basic block.  Note, this does no additonal
 //  lookups, just accesses the data that is already known.
 
 void
@@ -514,9 +515,9 @@ ranger_cache::ssa_range_in_bb (irange &r, tree name, basic_block bb)
       // NAME is defined in this block, so request its current value
       if (!m_globals.get_global_range (r, name))
 	{
-	  // If it doesn't have a value calculated, it means its a "poor" value
-	  // being used in some calculation.  Queue it up as a poor value to
-	  // be improved later.
+	  // If it doesn't have a value calculated, it means it's a
+	  // "poor" value being used in some calculation.  Queue it up
+	  // as a poor value to be improved later.
 	  r = gimple_range_global (name);
 	  if (push_poor_value (bb, name))
 	    {
@@ -551,14 +552,13 @@ ranger_cache::ssa_range_in_bb (irange &r, tree name, basic_block bb)
     }
 
   // Check if pointers have any non-null dereferences.  Non-call
-  // exceptions mean we could throw in the middle of he block, so just
+  // exceptions mean we could throw in the middle of the block, so just
   // punt for now on those.
   if (r.varying_p () && m_non_null.non_null_deref_p (name, bb) &&
       !cfun->can_throw_non_call_exceptions)
     r = range_nonzero (TREE_TYPE (name));
 }
 
-
 // Return a static range for NAME on entry to basic block BB in R.  If
 // calc is true, fill any cache entries required between BB and the
 // def block for NAME.  Otherwise, return false if the cache is empty.
@@ -594,7 +594,7 @@ ranger_cache::block_range (irange &r, basic_block bb, tree name, bool calc)
   return m_on_entry.get_bb_range (r, name, bb);
 }
 
-// Add BB to the list of blocks to update, unless its already in the list.
+// Add BB to the list of blocks to update, unless it's already in the list.
 
 void
 ranger_cache::add_to_update (basic_block bb)
@@ -603,7 +603,6 @@ ranger_cache::add_to_update (basic_block bb)
     m_update_list.quick_push (bb);
 }
 
-
 // If there is anything in the iterative update_list, continue
 // processing NAME until the list of blocks is empty.
 
@@ -617,8 +616,8 @@ ranger_cache::iterative_cache_update (tree name)
   int_range_max current_range;
   int_range_max e_range;
 
-  // Process each block by seeing if it's calculated range on entry is
-  // the same as it's cached value. IF there is a difference, update
+  // Process each block by seeing if its calculated range on entry is
+  // the same as its cached value. If there is a difference, update
   // the cache to reflect the new value, and check to see if any
   // successors have cache entries which may need to be checked for
   // updates.
@@ -628,13 +627,13 @@ ranger_cache::iterative_cache_update (tree name)
       bb = m_update_list.pop ();
       gcc_assert (m_on_entry.get_bb_range (current_range, name, bb));
 
-      // Calculate the "new" range on entry by unioning the pred edges..
+      // Calculate the "new" range on entry by unioning the pred edges.
       new_range.set_undefined ();
       FOR_EACH_EDGE (e, ei, bb->preds)
 	{
 	  if (DEBUG_CACHE)
 	    fprintf (dump_file, "   edge %d->%d :", e->src->index, bb->index);
-	  // Get whatever range we can for this edge
+	  // Get whatever range we can for this edge.
 	  if (!outgoing_edge_range_p (e_range, e, name))
 	    {
 	      ssa_range_in_bb (e_range, name, e->src);
@@ -678,7 +677,7 @@ ranger_cache::iterative_cache_update (tree name)
 	      fprintf (dump_file, "\n      Updating blocks :");
 	    }
 	  m_on_entry.set_bb_range (name, bb, new_range);
-	  // Mark each successor that has a range to re-check it's range
+	  // Mark each successor that has a range to re-check its range
 	  FOR_EACH_EDGE (e, ei, bb->succs)
 	    if (m_on_entry.bb_range_p (name, e->dest))
 	      {
@@ -699,7 +698,7 @@ ranger_cache::iterative_cache_update (tree name)
 }
 
 // Make sure that the range-on-entry cache for NAME is set for block BB.
-// Work back thourgh the CFG to DEF_BB ensuring the range is calculated
+// Work back through the CFG to DEF_BB ensuring the range is calculated
 // on the block/edges leading back to that point.
 
 void
@@ -711,7 +710,7 @@ ranger_cache::fill_block_cache (tree name, basic_block bb, basic_block def_bb)
   int_range_max undefined;
   unsigned poor_list_start = m_poor_value_list.length ();  
 
-  // At this point we shouldnt be looking at the def, entry or exit block.
+  // At this point we shouldn't be looking at the def, entry or exit block.
   gcc_checking_assert (bb != def_bb && bb != ENTRY_BLOCK_PTR_FOR_FN (cfun) &&
 		       bb != EXIT_BLOCK_PTR_FOR_FN (cfun));
 
@@ -761,7 +760,7 @@ ranger_cache::fill_block_cache (tree name, basic_block bb, basic_block def_bb)
 	    }
 
 	  // If the pred is entry but NOT def, then it is used before
-	  // defined, it'll get set to []. and no need to update it.
+	  // defined, it'll get set to [] and no need to update it.
 	  if (pred == ENTRY_BLOCK_PTR_FOR_FN (cfun))
 	    {
 	      if (DEBUG_CACHE)
@@ -769,8 +768,8 @@ ranger_cache::fill_block_cache (tree name, basic_block bb, basic_block def_bb)
 	      continue;
 	    }
 
-	  // Regardless of whther we have visited pred or not, if the pred has
-	  // a non-null reference, revisit this block.
+	  // Regardless of whether we have visited pred or not, if the
+	  // pred has a non-null reference, revisit this block.
 	  if (m_non_null.non_null_deref_p (name, pred))
 	    {
 	      if (DEBUG_CACHE)
@@ -795,7 +794,8 @@ ranger_cache::fill_block_cache (tree name, basic_block bb, basic_block def_bb)
 
 	  if (DEBUG_CACHE)
 	    fprintf (dump_file, "pushing undefined pred block. ");
-	  // If the pred hasn't been visited (has no range), add it to the list.
+	  // If the pred hasn't been visited (has no range), add it to
+	  // the list.
 	  gcc_checking_assert (!m_on_entry.bb_range_p (name, pred));
 	  m_on_entry.set_bb_range (name, pred, undefined);
 	  m_workback.quick_push (pred);
@@ -820,7 +820,7 @@ ranger_cache::fill_block_cache (tree name, basic_block bb, basic_block def_bb)
       while (poor_list_start < m_poor_value_list.length ())
 	{
 	  // Find a range for this unresolved value.   
-	  // Note this may spawn new cache filling cycles, but by the time it 
+	  // Note, this may spawn new cache filling cycles, but by the time it
 	  // is finished, the work vectors will all be back to the same state
 	  // as before the call.  The update record vector will always be
 	  // returned to the current state upon return.
@@ -842,7 +842,7 @@ ranger_cache::fill_block_cache (tree name, basic_block bb, basic_block def_bb)
 		       calc_bb->index);
 	    }
 
-	  // It must have a least one edge, pick edge 0.  we just want to
+	  // It must have at least one edge, pick edge 0.  we just want to
 	  // calculate a range at the exit from the block so the caches feeding
 	  // this block will be filled up. 
 	  gcc_checking_assert (EDGE_SUCC (calc_bb, 0));
@@ -870,7 +870,7 @@ ranger_cache::fill_block_cache (tree name, basic_block bb, basic_block def_bb)
 	    }
 	  if (DEBUG_CACHE)
 	    fprintf (dump_file, "\n");
-	  // Now see if there is a new value
+	  // Now see if there is a new value.
 	  iterative_cache_update (name);
 	}
     }
diff --git a/gcc/gimple-range-edge.cc b/gcc/gimple-range-edge.cc
index b7c0603e136..242c1a5c99d 100644
--- a/gcc/gimple-range-edge.cc
+++ b/gcc/gimple-range-edge.cc
@@ -74,7 +74,7 @@ outgoing_range::get_edge_range (irange &r, gimple *s, edge e)
   gswitch *sw = as_a<gswitch *> (s);
 
   // ADA currently has cases where the index is 64 bits and the case
-  // arguments are  32 bit, causing a trap when we create a case_range.
+  // arguments are 32 bit, causing a trap when we create a case_range.
   // Until this is resolved (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87798)
   // punt on switches where the labels dont match the argument.
   if (gimple_switch_num_labels (sw) > 1 && 
@@ -97,7 +97,8 @@ outgoing_range::get_edge_range (irange &r, gimple *s, edge e)
 }
 
 
-// calculate all switch edges from SW and cache them in the hash table.
+// Calculate all switch edges from SW and cache them in the hash table.
+
 void
 outgoing_range::calc_switch_ranges (gswitch *sw)
 {
@@ -109,9 +110,9 @@ outgoing_range::calc_switch_ranges (gswitch *sw)
   edge default_edge = gimple_switch_default_edge (cfun, sw);
   irange *&default_slot = m_edge_table->get_or_insert (default_edge, &existed);
 
-  // This should be the first call into this switch.
-  // For the default range case, start with varying and intersect each other 
-  // case from it. 
+  // This should be the first call into this switch.  For the default
+  // range case, start with varying and intersect each other case from
+  // it.
 
   gcc_assert (!existed);
 
@@ -152,7 +153,7 @@ outgoing_range::calc_switch_ranges (gswitch *sw)
 	    }
 	}
       // If there was an existing range and it doesn't fit, we lose the memory.
-      // it'll get reclaimed when the obstack is freed.  This seems less
+      // It'll get reclaimed when the obstack is freed.  This seems less
       // intrusive than allocating max ranges for each case.
       slot = range_pool.allocate (case_range);
     }
diff --git a/gcc/gimple-range-edge.h b/gcc/gimple-range-edge.h
index 6e161306c06..e31008f9920 100644
--- a/gcc/gimple-range-edge.h
+++ b/gcc/gimple-range-edge.h
@@ -24,14 +24,14 @@ along with GCC; see the file COPYING3.  If not see
 
 // This class is used to query ranges on constant edges in GIMPLE.
 //
-// For a COND_EXPR,  the TRUE edge will return [1,1] and the false edge a [0,0].
+// For a COND_EXPR, the TRUE edge will return [1,1] and the false edge a [0,0].
 //
-// For SWITCH_EXPR it is awkward to calculate ranges. When a request
+// For SWITCH_EXPR, it is awkward to calculate ranges.  When a request
 // is made, the entire switch is evalauted and the results cached. 
 // Any future requests to that switch will use the cached value, providing
 // dramatic decrease in computation time.
 //
-// The API is simple. just ask for the range on the edge.
+// The API is simple, just ask for the range on the edge.
 // The return value is NULL for no range, or the branch statement which the
 // edge gets the range from, along with the range.
 
diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc
index 08c7289c270..12020c3100b 100644
--- a/gcc/gimple-range-gori.cc
+++ b/gcc/gimple-range-gori.cc
@@ -97,8 +97,7 @@ private:
 };
 
 
-
-// Construct a range_def_chain
+// Construct a range_def_chain.
 
 range_def_chain::range_def_chain ()
 {
@@ -108,7 +107,7 @@ range_def_chain::range_def_chain ()
   m_terminal.safe_grow_cleared (num_ssa_names);
 }
 
-// Destruct a range_def_chain
+// Destruct a range_def_chain.
 
 range_def_chain::~range_def_chain ()
 {
@@ -129,7 +128,7 @@ range_def_chain::in_chain_p (tree name, tree def)
   gcc_checking_assert (gimple_range_ssa_p (def));
   gcc_checking_assert (gimple_range_ssa_p (name));
 
-  // Get the defintion chain for DEF
+  // Get the defintion chain for DEF.
   bitmap chain = get_def_chain (def);
 
   if (chain == NULL)
@@ -148,8 +147,8 @@ range_def_chain::terminal_name (tree name)
   return m_terminal[SSA_NAME_VERSION (name)];
 }
 
-// Given up to 3 ssa names, return the common name or NULL_TREE.
-// NULL_TREE's passed in can be ignored, but all specified ssa-names
+// Given up to 3 SSA names, return the common name or NULL_TREE.
+// NULL_TREE's passed in can be ignored, but all specified SSA names
 // must be the same name.
 
 static inline tree
@@ -166,7 +165,7 @@ pick_import (tree ssa1, tree ssa2, tree ssa3)
     }
   if (ssa2)
     {
-      // If there is no ssa3 or ssa3 is the same as ssa2, thats the import.
+      // If there is no ssa3 or ssa3 is the same as ssa2, that's the import.
       if (!ssa3 || ssa2 == ssa3)
         return ssa2;
       // They must both be different, so no import.
@@ -175,7 +174,7 @@ pick_import (tree ssa1, tree ssa2, tree ssa3)
   return ssa3;
 }
 
-// Build def_chains for NAME if it is in BB.. copy the def chain into
+// Build def_chains for NAME if it is in BB.  Copy the def chain into
 // RESULT.  Return the import for name, or NAME if it is an import.
 
 tree
@@ -188,7 +187,7 @@ range_def_chain::build_def_chain (tree name, bitmap result, basic_block bb)
 
   if (gimple_bb (def_stmt) == bb && !is_a<gphi *>(def_stmt))
     {
-      // Get the def chain for the operand
+      // Get the def chain for the operand.
       b = get_def_chain (name);
       // If there was one, copy it into result and return the terminal name.
       if (b)
@@ -198,7 +197,8 @@ range_def_chain::build_def_chain (tree name, bitmap result, basic_block bb)
 	}
       // If there is no def chain, this terminal is within the same BB.
     }
-  return name;	// This is an import.
+  // This is an import.
+  return name;
 }
 
 // Return TRUE if NAME has been processed for a def_chain.
@@ -254,10 +254,9 @@ range_def_chain::get_def_chain (tree name)
 
   basic_block bb = gimple_bb (stmt);
 
-  // Allocate a new bitmap and initialize it.
   m_def_chain[v] = BITMAP_ALLOC (NULL);
 
-  // build_def_chain returns the terminal name. If we have more than
+  // build_def_chain returns the terminal name.  If we have more than
   // one unique terminal name, then this statement will have no
   // terminal.
   bool has_term = true;
@@ -265,7 +264,7 @@ range_def_chain::get_def_chain (tree name)
   if (ssa1)
     {
       ssa1 = build_def_chain (ssa1, m_def_chain[v], bb);
-      // if this chain has no terminal, root cannot either.
+      // If this chain has no terminal, root cannot either.
       if (!ssa1)
         has_term = false;
     }
@@ -291,10 +290,10 @@ range_def_chain::get_def_chain (tree name)
   // huge (I'm thinking fppp for instance.. huge basic block fully
   // unrolled) we might be able to limit this by deciding here that if
   // there is no import AND 2 or more ssa names, we change the
-  // def_chain back to be just the ssa-names.  that should prevent a_2
-  // = b_6 + a_8 from creating a pathological case yet allow us to
+  // def_chain back to be just the ssa-names.  that should prevent
+  // a_2 = b_6 + a_8 from creating a pathological case yet allow us to
   // still handle it when b_6 and a_8 are derived from the same base
-  // name.  thoughts?
+  // name.  Thoughts?
   return m_def_chain[v];
 }
 
@@ -367,7 +366,7 @@ gori_map::~gori_map ()
   m_outgoing.release ();
 }
 
-// Return the bitmap vector of all imports to BB. Calculate if necessary.
+// Return the bitmap vector of all imports to BB.  Calculate if necessary.
 
 bitmap
 gori_map::imports (basic_block bb)
@@ -377,7 +376,7 @@ gori_map::imports (basic_block bb)
   return m_incoming[bb->index];
 }
 
-// Return true if NAME is an import to basic block BB
+// Return true if NAME is an import to basic block BB.
 
 bool
 gori_map::is_import_p (tree name, basic_block bb)
@@ -385,7 +384,7 @@ gori_map::is_import_p (tree name, basic_block bb)
   return bitmap_bit_p (imports (bb), SSA_NAME_VERSION (name));
 }
 
-// Return the bitmap vector of all export from BB. Calculate if necessary.
+// Return the bitmap vector of all export from BB.  Calculate if necessary.
 
 bitmap
 gori_map::exports (basic_block bb)
@@ -575,7 +574,7 @@ gori_map::dump(FILE *f, basic_block bb)
 }
 
 // Dump the entire GORI map structure to file F.
-//
+
 void
 gori_map::dump(FILE *f)
 {
@@ -596,7 +595,7 @@ debug (gori_map &g)
 
 // -------------------------------------------------------------------
 
-// Provide a default of VARYING for al incoming ssa-names.
+// Provide a default of VARYING for all incoming SSA names.
 
 void
 gori_compute::ssa_range_in_bb (irange &r, tree name, basic_block)
@@ -614,7 +613,7 @@ gori_compute::expr_range_in_bb (irange &r, tree expr, basic_block bb)
 }
 
 // Calculate the range for NAME if the lhs of statement S has the
-// range LHS.  Return the result in R. Return false if no range can be
+// range LHS.  Return the result in R.  Return false if no range can be
 // calculated.
 
 bool
@@ -668,7 +667,7 @@ gori_compute::gori_compute ()
   m_gori_map = new gori_map;
 }
 
-// Destruct a gori_compute_object
+// Destruct a gori_compute_object.
 
 gori_compute::~gori_compute ()
 {
@@ -707,7 +706,7 @@ gori_compute::compute_operand_range_switch (irange &r, gswitch *s,
 static inline bool
 is_gimple_logical_p (const gimple *gs)
 {
-  /* Look for boolean and/or condition.  */
+  // Look for boolean and/or condition.
   if (gimple_code (gs) == GIMPLE_ASSIGN)
     switch (gimple_expr_code (gs))
       {
@@ -921,6 +920,12 @@ gori_compute::logical_combine (irange &r, enum tree_code code,
   return true;
 }
 
+// Helper function for compute_logical_operands_in_chain that computes
+// the range of logical statements that can be computed without
+// chasing down operands.  These are things like [0 = x | y] where we
+// know neither operand can be non-zero, or [1 = x & y] where we know
+// neither operand can be zero.
+
 bool
 gori_compute::optimize_logical_operands (tf_range &range,
 					 gimple *stmt,
@@ -992,7 +997,7 @@ gori_compute::compute_logical_operands (irange &r, gimple *stmt,
 					tree name)
 {
   // Reaching this point means NAME is not in this stmt, but one of
-  // the names in it ought to be derived from it.  */
+  // the names in it ought to be derived from it.
   tree op1 = gimple_range_operand1 (stmt);
   tree op2 = gimple_range_operand2 (stmt);
   gcc_checking_assert (op1 != name && op2 != name);
@@ -1049,17 +1054,16 @@ gori_compute::compute_operand1_range (irange &r, gimple *stmt,
   op1_range.intersect (r);
 
   gimple *src_stmt = SSA_NAME_DEF_STMT (op1);
-  // If defstmt is outside of this BB, then name must be an import.
+  // If def stmt is outside of this BB, then name must be an import.
   if (!src_stmt || (gimple_bb (src_stmt) != gimple_bb (stmt)))
     {
-      // IF this isn't the right import statement, then abort calculation
+      // If this isn't the right import statement, then abort calculation.
       if (!src_stmt || gimple_get_lhs (src_stmt) != name)
         return false;
       return compute_name_range_op (r, src_stmt, op1_range, name);
     }
-  else
   // Then feed this range back as the LHS of the defining statement.
-    return compute_operand_range (r, src_stmt, op1_range, name);
+  return compute_operand_range (r, src_stmt, op1_range, name);
 }
 
 
@@ -1078,22 +1082,21 @@ gori_compute::compute_operand2_range (irange &r, gimple *stmt,
   expr_range_in_bb (op1_range, op1, gimple_bb (stmt));
   expr_range_in_bb (op2_range, op2, gimple_bb (stmt));
 
-  // INtersect with range for op2 based on lhs and op1.
+  // Intersect with range for op2 based on lhs and op1.
   if (gimple_range_calc_op2 (r, stmt, lhs, op1_range))
     op2_range.intersect (r);
 
   gimple *src_stmt = SSA_NAME_DEF_STMT (op2);
-  // If defstmt is outside of this BB, then name must be an import.
+  // If def stmt is outside of this BB, then name must be an import.
   if (!src_stmt || (gimple_bb (src_stmt) != gimple_bb (stmt)))
     {
-      // IF this isn't the right src statement, then abort calculation
+      // If  this isn't the right src statement, then abort calculation.
       if (!src_stmt || gimple_get_lhs (src_stmt) != name)
         return false;
       return compute_name_range_op (r, src_stmt, op2_range, name);
     }
-  else
   // Then feed this range back as the LHS of the defining statement.
-    return compute_operand_range (r, src_stmt, op2_range, name);
+  return compute_operand_range (r, src_stmt, op2_range, name);
 }
 
 // Calculate a range for NAME from both operand positions of S
@@ -1114,7 +1117,7 @@ gori_compute::compute_operand1_and_operand2_range
   if (!compute_operand2_range (op_range, stmt, lhs, name))
     return false;
 
-  // Now get the range thru op1...
+  // Now get the range thru op1.
   if (!compute_operand1_range (r, stmt, lhs, name))
     return false;
 
@@ -1454,6 +1457,7 @@ gori_compute_cache::cache_stmt (gimple *stmt)
   tree op2 = gimple_range_operand2 (stmt);
   int_range_max r_true_side, r_false_side;
 
+  // LHS = s_5 > 999.
   if (TREE_CODE (op2) == INTEGER_CST)
     {
       range_operator *handler = range_op_handler (code, TREE_TYPE (lhs));
@@ -1464,6 +1468,7 @@ gori_compute_cache::cache_stmt (gimple *stmt)
       handler->op1_range (r_false_side, type, m_bool_zero, op2_range);
       m_cache->set_range (lhs, op1, tf_range (r_true_side, r_false_side));
     }
+  // LHS = s_5 > b_8.
   else if (tree cached_name = m_cache->same_cached_name (op1, op2))
     {
       tf_range op1_range, op2_range;
diff --git a/gcc/gimple-range-gori.h b/gcc/gimple-range-gori.h
index 86d67f81d05..8ef452bf433 100644
--- a/gcc/gimple-range-gori.h
+++ b/gcc/gimple-range-gori.h
@@ -27,16 +27,16 @@ along with GCC; see the file COPYING3.  If not see
 // calculated for them on outgoing edges from basic blocks.  This represents
 // ONLY the effect of the basic block edge->src on a range.
 //
-// There are 2 primary entry points.
+// There are 2 primary entry points:
 //
 // has_edge_range_p (edge e, tree name)  
 //   returns true if the outgoing edge *may* be able to produce range
 //   information for ssa_name NAME on edge E.
-//   FALSE is returned if this edge does not affect the range of NAME,
+//   FALSE is returned if this edge does not affect the range of NAME.
 //
 // outgoing_edge_range_p (irange &range, edge e, tree name)
 //   Actually does the calculation of RANGE for name on E
-//   This represents application of whatever static range effect edge  E
+//   This represents application of whatever static range effect edge E
 //   may have on NAME, not any cumulative effect.
 
 // There are also some internal APIs
@@ -45,24 +45,23 @@ along with GCC; see the file COPYING3.  If not see
 // calculation chain using SSA_NAMES which come from outside the block. ie
 //      a_2 = b_4 - 8
 //      if (a_2 < 30)
-// on the true edge, a_2 is known to be [0, 29] 
+// on the true edge, a_2 is known to be [0, 29]
 // b_4 can be calculated as [8, 37]
 // during this calculation, b_4 is considered an "import" and ssa_range_in_bb
-// is queried for a starting range which is used in the calculation. 
+// is queried for a starting range which is used in the calculation.
 // A default value of VARYING provides the raw static info for the edge.
 //
-// IF there is any known range for b_4 coming into this block, it can refine
+// If there is any known range for b_4 coming into this block, it can refine
 // the results.  This allows for cascading results to be propogated.
 // if b_4 is [100, 200] on entry to the block, feeds into the calculation
 // of a_2 = [92, 192], and finally on the true edge the range would be 
-// an empty range [] because it is not possibel for the true edge to be taken.
+// an empty range [] because it is not possible for the true edge to be taken.
 //
 // expr_range_in_bb is simply a wrapper which calls ssa_range_in_bb for 
-// SSA_NAMES and otherwise simply calcautes te range of the expression.
+// SSA_NAMES and otherwise simply calculates the range of the expression.
 //
 // The remaining routines are internal use only.
 
-
 class gori_compute 
 {
 public:
@@ -111,17 +110,16 @@ private:
 
 // This class adds a cache to gori_computes for logical expressions.
 //       bool result = x && y
-// requires calcuation of both x and Y for both true and false results.
-// there are 4 combinations [0,0][0,0] [0,0][1,1] [1,1][0,0] and [1,1][1,1].
-// note that each pair of possible results for x and Y are uses twice,and
+// requires calcuation of both X and Y for both true and false results.
+// There are 4 combinations [0,0][0,0] [0,0][1,1] [1,1][0,0] and [1,1][1,1].
+// Note that each pair of possible results for X and Y are used twice, and
 // the calcuation of those results are the same each time.
 //
 // The cache simply checks if a stmt is cachable, and if so, saves both the
 // true and false results for the next time the query is made.
 //
-// This is used to speed up long chains of logical operations which become
-// expoential quickly.
-//
+// This is used to speed up long chains of logical operations which
+// quickly become exponential.
 
 class gori_compute_cache : public gori_compute
 {
diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc
index d423bb09dd0..96544b8d58f 100644
--- a/gcc/gimple-range.cc
+++ b/gcc/gimple-range.cc
@@ -143,7 +143,6 @@ gimple_range_adjustment (irange &res, const gimple *stmt)
     }
 }
 
-
 // Return a range in R for the tree EXPR.  Return true if a range is
 // representable.
 
@@ -204,7 +203,6 @@ gimple_range_fold (irange &res, const gimple *stmt, const irange &r1)
   return gimple_range_fold (res, stmt, r1, r2);
 }
 
-
 // Fold this binary statement using R1 and R2 as the operands ranges,
 // returning the result in RES.  Return false if the operation fails.
 
@@ -269,7 +267,6 @@ gimple_range_operand1 (const gimple *stmt)
   return NULL;
 }
 
-
 // Return the second operand of statement STMT, otherwise return NULL_TREE.
 
 tree
@@ -290,8 +287,6 @@ gimple_range_operand2 (const gimple *stmt)
   return NULL_TREE;
 }
 
-
-
 // Calculate what we can determine of the range of this unary
 // statement's operand if the lhs of the expression has the range
 // LHS_RANGE.  Return false if nothing can be determined.
@@ -300,8 +295,8 @@ bool
 gimple_range_calc_op1 (irange &r, const gimple *stmt, const irange &lhs_range)
 {
   gcc_checking_assert (gimple_num_ops (stmt) < 3);
-  // An empty range is viral, so return an empty range.
 
+  // An empty range is viral.
   tree type = TREE_TYPE (gimple_range_operand1 (stmt));
   if (lhs_range.undefined_p ())
     {
@@ -315,7 +310,6 @@ gimple_range_calc_op1 (irange &r, const gimple *stmt, const irange &lhs_range)
 						 type_range);
 }
 
-
 // Calculate what we can determine of the range of this statement's
 // first operand if the lhs of the expression has the range LHS_RANGE
 // and the second operand has the range OP2_RANGE.  Return false if
@@ -327,9 +321,9 @@ gimple_range_calc_op1 (irange &r, const gimple *stmt,
 {
   // Unary operation are allowed to pass a range in for second operand
   // as there are often additional restrictions beyond the type which
-  // can be imposed.  See operator_cast::op1_range.()
+  // can be imposed.  See operator_cast::op1_range().
   tree type = TREE_TYPE (gimple_range_operand1 (stmt));
-  // An empty range is viral, so return an empty range.
+  // An empty range is viral.
   if (op2_range.undefined_p () || lhs_range.undefined_p ())
     {
       r.set_undefined ();
@@ -339,7 +333,6 @@ gimple_range_calc_op1 (irange &r, const gimple *stmt,
 						 op2_range);
 }
 
-
 // Calculate what we can determine of the range of this statement's
 // second operand if the lhs of the expression has the range LHS_RANGE
 // and the first operand has the range OP1_RANGE.  Return false if
@@ -350,7 +343,7 @@ gimple_range_calc_op2 (irange &r, const gimple *stmt,
 		       const irange &lhs_range, const irange &op1_range)
 {
   tree type = TREE_TYPE (gimple_range_operand2 (stmt));
-  // An empty range is viral, so return an empty range.
+  // An empty range is viral.
   if (op1_range.undefined_p () || lhs_range.undefined_p ())
     {
       r.set_undefined ();
@@ -360,7 +353,6 @@ gimple_range_calc_op2 (irange &r, const gimple *stmt,
 						 op1_range);
 }
 
-
 // Calculate a range for statement S and return it in R. If NAME is provided it
 // represents the SSA_NAME on the LHS of the statement. It is only required
 // if there is more than one lhs/output.  If a range cannot
@@ -370,7 +362,7 @@ bool
 gimple_ranger::calc_stmt (irange &r, gimple *s, tree name)
 {
   bool res = false;
-  // If name is specified, make sure it is a LHS of S.
+  // If name is specified, make sure it is an LHS of S.
   gcc_checking_assert (name ? SSA_NAME_DEF_STMT (name) == s : true);
 
   if (gimple_range_handler (s))
@@ -435,7 +427,6 @@ gimple_ranger::range_of_range_op (irange &r, gimple *s)
   return true;
 }
 
-
 // Calculate the range of a non-trivial assignment.  That is, is one
 // inolving arithmetic on an SSA name (for example, an ADDR_EXPR).
 // Return the range in R.
@@ -466,7 +457,6 @@ gimple_ranger::range_of_non_trivial_assignment (irange &r, gimple *stmt)
   return false;
 }
 
-
 // Calculate a range for phi statement S and return it in R.
 // If a range cannot be calculated, return false.
 
@@ -481,7 +471,7 @@ gimple_ranger::range_of_phi (irange &r, gphi *phi)
   if (!irange::supports_type_p (type))
     return false;
 
-  // start with an empty range, unioning in each argument's range.
+  // Start with an empty range, unioning in each argument's range.
   r.set_undefined ();
   for (x = 0; x < gimple_phi_num_args (phi); x++)
     {
@@ -523,7 +513,6 @@ gimple_ranger::range_of_phi (irange &r, gphi *phi)
   return true;
 }
 
-
 // Calculate a range for call statement S and return it in R.
 // If a range cannot be calculated, return false.
 
@@ -547,7 +536,7 @@ gimple_ranger::range_of_call (irange &r, gcall *call)
   else
     r.set_varying (type);
 
-  // If there is a lHS, intersect that with what is known.
+  // If there is an LHS, intersect that with what is known.
   if (lhs)
     {
       value_range def;
@@ -574,17 +563,15 @@ gimple_ranger::range_of_builtin_ubsan_call (irange &r, gcall *call,
   gcc_assert (range_of_expr (ir1, arg1, call));
 
   bool saved_flag_wrapv = flag_wrapv;
-  /* Pretend the arithmetics is wrapping.  If there is
-     any overflow, we'll complain, but will actually do
-     wrapping operation.  */
+  // Pretend the arithmetic is wrapping.  If there is any overflow,
+  // we'll complain, but will actually do wrapping operation.
   flag_wrapv = 1;
   op->fold_range (r, type, ir0, ir1);
   flag_wrapv = saved_flag_wrapv;
 
-  /* If for both arguments vrp_valueize returned non-NULL,
-     this should have been already folded and if not, it
-     wasn't folded because of overflow.  Avoid removing the
-     UBSAN_CHECK_* calls in that case.  */
+  // If for both arguments vrp_valueize returned non-NULL, this should
+  // have been already folded and if not, it wasn't folded because of
+  // overflow.  Avoid removing the UBSAN_CHECK_* calls in that case.
   if (r.singleton_p ())
     r.set_varying (type);
 }
@@ -796,7 +783,6 @@ gimple_ranger::range_of_builtin_call (irange &r, gcall *call)
 
 
 
-
 // Calculate a range for COND_EXPR statement S and return it in R.
 // If a range cannot be calculated, return false.
 
@@ -821,7 +807,7 @@ gimple_ranger::range_of_cond_expr  (irange &r, gassign *s)
   // If the condition is known, choose the appropriate expression.
   if (cond_range.singleton_p ())
     {
-      // False, pick second operand
+      // False, pick second operand.
       if (cond_range.zero_p ())
 	r = range2;
       else
@@ -835,8 +821,6 @@ gimple_ranger::range_of_cond_expr  (irange &r, gassign *s)
   return true;
 }
 
-
-
 bool
 gimple_ranger::range_of_expr (irange &r, tree expr, gimple *stmt)
 {
@@ -876,7 +860,6 @@ gimple_ranger::range_of_expr (irange &r, tree expr, gimple *stmt)
   return true;
 }
 
-
 // Return the range of NAME on entry to block BB in R.
 
 void
@@ -893,7 +876,6 @@ gimple_ranger::range_on_entry (irange &r, basic_block bb, tree name)
     r.intersect (entry_range);
 }
 
-
 // Calculate the range for NAME at the end of block BB and return it in R.
 // Return false if no range can be calculated.
 
@@ -975,7 +957,6 @@ gimple_ranger::range_of_stmt (irange &r, gimple *s, tree name)
   return true;
 }
 
-
 // This routine will export whatever global ranges are known to GCC
 // SSA_RANGE_NAME_INFO fields.
 
@@ -1025,7 +1006,6 @@ gimple_ranger::export_global_ranges ()
     }
 }
 
-
 // Print the known table values to file F.
 
 void
@@ -1044,7 +1024,7 @@ gimple_ranger::dump (FILE *f)
 
       dump_bb (f, bb, 4, TDF_NONE);
 
-      // Now find any globals defined in this block
+      // Now find any globals defined in this block.
       for (x = 1; x < num_ssa_names; x++)
 	{
 	  tree name = ssa_name (x);
@@ -1195,7 +1175,6 @@ trace_ranger::trailer (unsigned counter, const char *caller, bool result,
   return result;
 }
 
-
 // Tracing version of range_on_edge.  Call it with printing wrappers.
 
 bool
diff --git a/gcc/gimple-range.h b/gcc/gimple-range.h
index 8f108f585d5..c86dba3c520 100644
--- a/gcc/gimple-range.h
+++ b/gcc/gimple-range.h
@@ -128,7 +128,7 @@ gimple_range_global (tree name)
   // for builtin_unreachable in the code, like
   // RUNTESTFLAGS=dg.exp=pr61034.C check-g++
   // pre-optimizations (inlining) set a global range which causes the ranger
-  // to remove the condition which leads to builtin_unreachable
+  // to remove the condition which leads to builtin_unreachable.
   if (!POINTER_TYPE_P (type) && SSA_NAME_RANGE_INFO (name))
     {
       // Return a range from an SSA_NAME's available range.
diff --git a/gcc/gimple-ssa-evrp.c b/gcc/gimple-ssa-evrp.c
index d6b1749ddce..5bb590685d0 100644
--- a/gcc/gimple-ssa-evrp.c
+++ b/gcc/gimple-ssa-evrp.c
@@ -159,12 +159,12 @@ private:
   simplify_using_ranges m_simplifier;
 };
 
-// In a hybrid folder, start with an EVRP folder, and add the required fold_stmt
-// bits do either try the ranger first or second.
+// In a hybrid folder, start with an EVRP folder, and add the required
+// fold_stmt bits to either try the ranger first or second.
 //
 // The 3 value_* routines will always query both EVRP and the ranger for
-// a result, and ensure they return the same value. If either returns a value 
-// when the other doesn't it is flagged in the listing, and the discoverd
+// a result, and ensure they return the same value.  If either returns a value
+// when the other doesn't, it is flagged in the listing, and the discoverd
 // value is returned.
 //
 // The simplifier is unable to process 2 different sources, thus we try to 
@@ -275,7 +275,6 @@ hybrid_folder::choose_value (tree evrp_val, tree ranger_val)
       return evrp_val;
     }
 
-
   // Otherwise ranger found a value, if they match we're good.
   if (evrp_val && !compare_values (evrp_val, ranger_val))
     return evrp_val;
diff --git a/gcc/gimple-ssa-warn-alloca.c b/gcc/gimple-ssa-warn-alloca.c
index 44b22ff2fe3..e85700eae5c 100644
--- a/gcc/gimple-ssa-warn-alloca.c
+++ b/gcc/gimple-ssa-warn-alloca.c
@@ -228,7 +228,7 @@ alloca_call_type (range_query &query, gimple *stmt, bool is_vla)
       return ret;
     }
 
-  // If the user specified a limit, use it possibly warn.
+  // If the user specified a limit, use it.
   int_range_max r;
   if (warn_limit_specified_p (is_vla)
       && TREE_CODE (len) == SSA_NAME


More information about the Gcc-cvs mailing list