summaryrefslogtreecommitdiff
path: root/gcc/ipa-str-reorg-instance-interleave.c
diff options
context:
space:
mode:
authorGary Oblock <gary@amperecomputing.com>2020-09-07 20:53:31 -0700
committerGary Oblock <gary@amperecomputing.com>2020-09-07 20:53:31 -0700
commitaaafa91d98dd64130398c992b61ec42cff160c9a (patch)
tree0031c238ebdcce23d717acc5e3fe4c740f3c7a58 /gcc/ipa-str-reorg-instance-interleave.c
parent505cb71e1db6ca699d06b4d6ba1a0a0865605fd4 (diff)
The phi case for setting a pointer to zero.
Diffstat (limited to 'gcc/ipa-str-reorg-instance-interleave.c')
-rw-r--r--gcc/ipa-str-reorg-instance-interleave.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/ipa-str-reorg-instance-interleave.c b/gcc/ipa-str-reorg-instance-interleave.c
index 82a3919100a..16633d4f87c 100644
--- a/gcc/ipa-str-reorg-instance-interleave.c
+++ b/gcc/ipa-str-reorg-instance-interleave.c
@@ -1297,6 +1297,42 @@ str_reorg_instance_interleave_trans ( Info *info)
}
}
}
+ // Iterate over the PHIs and for any PHI that is a reorgtype,
+ // transform any constant zero into it's new repersentation.
+ // OR MAYBE... use FOR_EACH_PHI_ARG for the iterator...
+
+ DEBUG_L("Phis with constant operands:\n");
+ INDENT(4);
+ gphi_iterator pi;
+ for ( pi = gsi_start_phis (bb); !gsi_end_p (pi); gsi_next (&pi))
+ {
+ //gimple_stmt_iterator gsi = as_a <gimple_stmt_iterator> pi;
+ gphi *phi = pi.phi ();
+ gimple *stmt = static_cast <gimple *> (phi);
+
+ DEBUG_A("phi: ");
+ DEBUG_F( print_gimple_stmt, stderr, stmt, 0);
+
+ ReorgType_t *ri = contains_a_reorgtype( stmt, info);
+ if ( ri != NULL && number_of_levels ( TREE_TYPE ( PHI_RESULT ( stmt))) == 1 )
+ {
+ for (int i = 0; i < gimple_phi_num_args (phi); i++)
+ {
+ tree *arg = gimple_phi_arg_def_ptr (phi, i);
+ DEBUG_A("arg[%d] = ",i);
+ DEBUG_F(flexible_print, stderr, *arg, 1, (dump_flags_t)0);
+ bool int_cst = TREE_CODE ( *arg) == INTEGER_CST;
+ DEBUG_A("is %sinteger constant\n", int_cst ? "" : "not ");
+ if ( int_cst && integer_zerop ( *arg) )
+ {
+ *arg = TYPE_MAX_VALUE ( ri->pointer_rep);
+ DEBUG_L("arg after = ");
+ DEBUG_F(flexible_print, stderr, *arg, 1, (dump_flags_t)0);
+ }
+ }
+ }
+ }
+ INDENT(-4);
}
pop_cfun ();
}