summaryrefslogtreecommitdiff
path: root/gcc/tree-switch-conversion.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2008-10-11 08:55:43 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2008-10-11 08:55:43 +0000
commit29ad7188582f2805094d993d189cbe676d84aa22 (patch)
tree7ee16b76a9eee4b027d70094c96fb31d27bea334 /gcc/tree-switch-conversion.c
parente9d51dd3ed5bbd43d7a6718e7822c495916c1413 (diff)
downloadgcc-29ad7188582f2805094d993d189cbe676d84aa22.tar.gz
PR target/35760
* config/rs6000/rs6000.c (rs6000_legitimize_address): Only create LO_SUM on Darwin if mode has just one unit. * gcc.c-torture/compile/pr35760.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@141055 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-switch-conversion.c')
-rw-r--r--gcc/tree-switch-conversion.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index e9757454f21..798cf161569 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -296,12 +296,29 @@ check_final_bb (void)
{
basic_block bb = gimple_phi_arg_edge (phi, i)->src;
- if ((bb == info.switch_bb
- || (single_pred_p (bb) && single_pred (bb) == info.switch_bb))
- && !is_gimple_ip_invariant (gimple_phi_arg_def (phi, i)))
+ if (bb == info.switch_bb
+ || (single_pred_p (bb) && single_pred (bb) == info.switch_bb))
{
- info.reason = " Non-invariant value from a case\n";
- return false; /* Non-invariant argument. */
+ tree reloc, val;
+
+ val = gimple_phi_arg_def (phi, i);
+ if (!is_gimple_ip_invariant (val))
+ {
+ info.reason = " Non-invariant value from a case\n";
+ return false; /* Non-invariant argument. */
+ }
+ reloc = initializer_constant_valid_p (val, TREE_TYPE (val));
+ if ((flag_pic && reloc != null_pointer_node)
+ || (!flag_pic && reloc == NULL_TREE))
+ {
+ if (reloc)
+ info.reason
+ = " Value from a case would need runtime relocations\n";
+ else
+ info.reason
+ = " Value from a case is not a valid initializer\n";
+ return false;
+ }
}
}
}