You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
+the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
#include "config.h"
#include "system.h"
#include "tree-pass.h"
#include "langhooks.h"
-extern void rename_ssa_copies (void);
-
/* The following routines implement the SSA copy renaming phase.
This optimization looks for copies between 2 SSA_NAMES, either through a
root1 = SSA_NAME_VAR (rep1);
root2 = SSA_NAME_VAR (rep2);
- if (DECL_HARD_REGISTER (root1) || DECL_HARD_REGISTER (root2))
- {
- if (debug)
- {
- if (DECL_HARD_REGISTER (root1))
- print_generic_expr (debug, var1, TDF_SLIM);
- else
- print_generic_expr (debug, var2, TDF_SLIM);
- fprintf (debug, " is a hardware register. No Coalescing.\n");
- }
- return;
- }
-
ann1 = var_ann (root1);
ann2 = var_ann (root2);
return;
}
+ /* Don't coalesce if one of the variables occurs in an abnormal PHI. */
+ abnorm = (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rep1)
+ || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rep2));
+ if (abnorm)
+ {
+ if (debug)
+ fprintf (debug, " : Abnormal PHI barrier. No coalesce.\n");
+ return;
+ }
+
/* Partitions already have the same root, simply merge them. */
if (root1 == root2)
{
return;
}
- /* Don't coalesce if one of the variables occurs in an abnormal PHI. */
- abnorm = (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rep1)
- || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rep2));
- if (abnorm)
+ /* Don't coalesce if the aliasing sets of the types are different. */
+ if (POINTER_TYPE_P (TREE_TYPE (root1))
+ && POINTER_TYPE_P (TREE_TYPE (root2))
+ && get_alias_set (TREE_TYPE (TREE_TYPE (root1)))
+ != get_alias_set (TREE_TYPE (TREE_TYPE (root2))))
{
if (debug)
- fprintf (debug, " : Abnormal PHI barrier. No coalesce.\n");
+ fprintf (debug, " : 2 different aliasing sets. No coalesce.\n");
return;
}
+
/* Merge the two partitions. */
p3 = partition_union (map->var_partition, p1, p2);
then cause the SSA->normal pass to attempt to coalesce them all to the same
variable. */
-void
+static void
rename_ssa_copies (void)
{
var_map map;