summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa
diff options
context:
space:
mode:
authorjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-02 15:37:38 +0000
committerjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-02 15:37:38 +0000
commit03f99d3c9c661055b5308b39a6939ae8598f604f (patch)
treec5080ee359d717b439069963cb722bd18f086222 /gcc/testsuite/gcc.dg/ipa
parentd6b19f6bc6c71621f8c894b07706e14e1301cb39 (diff)
downloadgcc-03f99d3c9c661055b5308b39a6939ae8598f604f.tar.gz
2011-09-02 Martin Jambor <mjambor@suse.cz>
* ipa-prop.h (ipa_node_params): Removed fields called_with_var_arguments and node_versionable. (ipa_set_called_with_variable_arg): Removed. (ipa_is_called_with_var_arguments): Likewise. * ipa-cp.c (ipa_get_lattice): Fixed index check in an assert. (determine_versionability): Do not check for type attributes and va builtins. Record versionability into inline summary. (initialize_node_lattices): Do not check ipa_is_called_with_var_arguments. (propagate_constants_accross_call): Likewise, ignore arguments we do not have PARM_DECLs for, set variable flag for parameters that were not passed a value. (create_specialized_node): Dump info that we cannot change signature. * ipa-prop.c (ipa_compute_jump_functions): Do not care about variable number of arguments. (ipa_make_edge_direct_to_target): Likewise. (ipa_update_after_lto_read): Likewise. (ipa_node_duplication_hook): Do not copy called_with_var_arguments flag. * tree-inline.c (copy_arguments_for_versioning): Copy PARM_DECLs if they were remapped. * testsuite/gcc.dg/ipa/ipcp-3.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178485 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/ipa')
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipcp-3.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-3.c b/gcc/testsuite/gcc.dg/ipa/ipcp-3.c
new file mode 100644
index 00000000000..1443b73ebcd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipcp-3.c
@@ -0,0 +1,70 @@
+/* Verify that IPA-CP can clone mark_cell without miscompiling it despite its
+ type_attributes. */
+/* { dg-do run } */
+/* { dg-options "-O3 -fdump-ipa-cp" } */
+
+
+struct PMC {
+ unsigned flags;
+};
+
+typedef struct Pcc_cell
+{
+ struct PMC *p;
+ long bla;
+ long type;
+} Pcc_cell;
+
+int gi;
+
+extern void abort ();
+extern void never_ever(int * interp, struct PMC *pmc)
+ __attribute__((noinline));
+
+void never_ever (int * interp, struct PMC *pmc)
+{
+ abort ();
+}
+
+static void mark_cell(int * interp, Pcc_cell *c)
+ __attribute__((__nonnull__(1)))
+ __attribute__((noinline));
+
+static void
+mark_cell(int * interp, Pcc_cell *c)
+{
+ if (c && c->type == 4 && c->p
+ && !(c->p->flags & (1<<18)))
+ never_ever(interp, c->p);
+}
+
+static void foo(int * interp, Pcc_cell *c)
+ __attribute__((noinline));
+
+static void
+foo(int * interp, Pcc_cell *c)
+{
+ mark_cell(interp, c);
+}
+
+static struct Pcc_cell *
+__attribute__((noinline,noclone))
+getnull(void)
+{
+ return (struct Pcc_cell *) 0;
+}
+
+
+int main()
+{
+ int i;
+
+ for (i = 0; i < 100; i++)
+ foo (&gi, getnull ());
+ return 0;
+}
+
+
+/* { dg-final { scan-ipa-dump "Creating a specialized node of mark_cell" "cp" } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+