aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2015-01-12 11:39:25 +0100
committerMartin Liska <marxin@gcc.gnu.org>2015-01-12 10:39:25 +0000
commit365536ca8d8af9d8b25a41217626df5794049676 (patch)
tree746342e7bbaadb4d6b4a26a0086bbbc941af331d /gcc
parent1c928ddc69d2f9c9ff2105635a666d82c2e0ee98 (diff)
downloadgcc-365536ca8d8af9d8b25a41217626df5794049676.zip
gcc-365536ca8d8af9d8b25a41217626df5794049676.tar.gz
gcc-365536ca8d8af9d8b25a41217626df5794049676.tar.bz2
re PR ipa/64550 (IPA fixes cause ICE in tree-ssa.c:939)
Fix for PR64550. PR ipa/64550 * ipa-icf-gimple.c (func_checker::compare_memory_operand): Compare volatility for correct operands. * gcc.dg/ipa/PR64550.c: New test. From-SVN: r219457
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/ipa-icf-gimple.c2
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/ipa/PR64550.c76
4 files changed, 93 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3205cec..a2486a9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,17 @@
2015-01-12 Martin Liska <mliska@suse.cz>
+ PR ipa/64550
+ * ipa-icf-gimple.c (func_checker::compare_memory_operand): Compare
+ volatility for correct operands.
+
+2015-01-12 Martin Liska <mliska@suse.cz>
+
+ * ipa-icf.c (sem_function::equals_wpa): Add indirect_calls as indication
+ that a function is not leaf.
+ (sem_function::compare_polymorphic_p): Likewise.
+
+2015-01-12 Martin Liska <mliska@suse.cz>
+
* ipa-icf.c (sem_function::equals_wpa): Add indirect_calls as indication
that a function is not leaf.
(sem_function::compare_polymorphic_p): Likewise.
diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c
index 8c3a27b..ed3cdf5 100644
--- a/gcc/ipa-icf-gimple.c
+++ b/gcc/ipa-icf-gimple.c
@@ -267,7 +267,7 @@ func_checker::compare_memory_operand (tree t1, tree t2)
/* Compare alias sets for memory operands. */
if (source_is_memop && target_is_memop)
{
- if (TREE_THIS_VOLATILE (b1) != TREE_THIS_VOLATILE (b2))
+ if (TREE_THIS_VOLATILE (t1) != TREE_THIS_VOLATILE (t2))
return return_false_with_msg ("different operand volatility");
if (ao_ref_alias_set (&r1) != ao_ref_alias_set (&r2)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9378266..7e3489b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2015-01-12 Martin Liska <mliska@suse.cz>
+
+ * gcc.dg/ipa/PR64550.c: New test.
+
2015-01-12 Jan Hubicka <hubicka@ucw.cz>
PR ipa/63470
diff --git a/gcc/testsuite/gcc.dg/ipa/PR64550.c b/gcc/testsuite/gcc.dg/ipa/PR64550.c
new file mode 100644
index 0000000..3b439c9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/PR64550.c
@@ -0,0 +1,76 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-ipa-icf-details" } */
+
+struct __hlist_head
+{
+ struct __hlist_node *first;
+};
+
+struct __hlist_node
+{
+ struct __hlist_node *next, **pprev;
+};
+
+struct __net
+{
+ int ifindex;
+ struct __hlist_head * dev_index_head;
+};
+
+struct __net_device
+{
+ int ifindex;
+ struct __net *nd_net;
+ struct __hlist_node index_hlist;
+};
+
+__attribute__ ((noinline, noclone))
+static struct __hlist_head * __dev_index_hash(struct __net *net,
+ int ifindex)
+{
+ return &net->dev_index_head[ifindex & 1];
+}
+
+__attribute__ ((noinline, noclone))
+struct __net_device * __dev_get_by_index(struct __net *net, int ifindex)
+{
+ struct __net_device * dev;
+ struct __hlist_head * head = __dev_index_hash(net, ifindex);
+
+ for (dev = ( { typeof((head)->first) ____ptr = ((head)->first); ____ptr ? ( { const typeof(((typeof(*(dev)) *) 0)->index_hlist) * __mptr = (____ptr); (typeof(*(dev)) *) ((char *)__mptr - __builtin_offsetof(typeof(*(dev)), index_hlist));}): ((void *) 0);});
+ dev; dev = ( { typeof ((dev)->index_hlist.next) ____ptr = ((dev)->index_hlist.next); ____ptr ? ( { const typeof(((typeof(*(dev)) *) 0)->index_hlist) * __mptr = (____ptr); (typeof(*(dev)) *) ((char *)__mptr - __builtin_offsetof(typeof(*(dev)), index_hlist));}): ((void *) 0);}))
+ if (dev->ifindex == ifindex)
+ return dev;
+
+ return ((void *)0);
+}
+
+__attribute__ ((noinline, noclone))
+struct __net_device * dev_get_by_index_rcu(struct __net *net, int ifindex)
+{
+ struct __net_device * dev;
+ struct __hlist_head * head = __dev_index_hash(net, ifindex);
+
+ for (dev = ( { typeof(( { typeof (* ((*((struct __hlist_node **)(&(head)->first))))) * _________p1 = (typeof(*((*((struct __hlist_node **)(&(head)->first))))) *) (*(volatile typeof(((*((struct __hlist_node **)(&(head)->first))))) *)&(((*((struct __hlist_node **)(&(head)->first)))))); do { } while (0);; do { } while (0); ((typeof(*((*((struct __hlist_node **)(&(head)->first))))) *) (_________p1));})) ____ptr = (( { typeof (* ((*((struct __hlist_node **)(&(head)->first))))) * _________p1 = (typeof(*((*((struct __hlist_node **)(&(head)->first))))) *) (*(volatile typeof(((*((struct __hlist_node **)(&(head)->first))))) *)&(((*((struct __hlist_node **)(&(head)->first)))))); do { } while (0);; do { } while (0); ((typeof(*((*((struct __hlist_node **)(&(head)->first))))) *) (_________p1));})); ____ptr ? ( { const typeof(((typeof(*(dev)) *) 0)->index_hlist) * __mptr = (____ptr); (typeof(*(dev)) *) ((char *)__mptr - __builtin_offsetof(typeof(*(dev)), index_hlist));}):((void *) 0);});
+ dev; dev = ( { typeof(( { typeof (* ((*((struct __hlist_node **)(&(&(dev)->index_hlist)->next))))) * _________p1 = (typeof(*((*((struct __hlist_node **)(&(&(dev)->index_hlist)->next))))) *) (*(volatile typeof(((*((struct __hlist_node **)(&(&(dev)->index_hlist)->next))))) *)&(((*((struct __hlist_node **)(&(&(dev)->index_hlist)->next)))))); do { } while (0);; do { } while (0); ((typeof(*((*((struct __hlist_node **)(&(&(dev)->index_hlist)->next))))) *) (_________p1));})) ____ptr = (( { typeof (* ((*((struct __hlist_node **)(&(&(dev)->index_hlist)->next))))) * _________p1 = (typeof(*((*((struct __hlist_node **)(&(&(dev)->index_hlist)->next))))) *) (*(volatile typeof(((*((struct __hlist_node **)(&(&(dev)->index_hlist)->next))))) *)&(((*((struct __hlist_node **)(&(&(dev)->index_hlist)->next)))))); do { } while (0);; do { } while (0); ((typeof(*((*((struct __hlist_node **)(&(&(dev)->index_hlist)->next))))) *) (_________p1));})); ____ptr ? ( { const typeof(((typeof(*(dev)) *) 0)->index_hlist) * __mptr = (____ptr); (typeof(*(dev)) *) ((char *)__mptr - __builtin_offsetof(typeof(*(dev)), index_hlist));}): ((void *) 0);}))
+ if (dev->ifindex == ifindex)
+ return dev;
+ return ((void *)0);
+}
+
+__attribute__ ((noinline, noclone))
+int foo(struct __net *net)
+{
+ if (!__dev_get_by_index(net, net->ifindex));
+ return 1;
+ return 0;
+}
+
+int main()
+{
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump "different operand volatility" "icf" } } */
+/* { dg-final { scan-ipa-dump "Equal symbols: 0" "icf" } } */
+/* { dg-final { cleanup-ipa-dump "icf" } } */