hash_map<tree, gensum_param_desc *> *decl2desc;
-/* All local DECLs ever loaded from. */
+/* All local DECLs ever loaded from of and of those that have their address
+ assigned to a variable. */
hash_set <tree> *loaded_decls;
bool deref = false;
bool reverse;
+ if (TREE_CODE (expr) == ADDR_EXPR)
+ {
+ if (ctx == ISRA_CTX_ARG)
+ return;
+ tree t = get_base_address (TREE_OPERAND (expr, 0));
+ if (TREE_CODE (t) == VAR_DECL && !TREE_STATIC (t))
+ loaded_decls->add (t);
+ return;
+ }
+ if (TREE_CODE (expr) == SSA_NAME
+ || CONSTANT_CLASS_P (expr))
+ return;
+
if (TREE_CODE (expr) == BIT_FIELD_REF
|| TREE_CODE (expr) == IMAGPART_EXPR
|| TREE_CODE (expr) == REALPART_EXPR)
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-ipa-sra-details" } */
+
+struct S
+{
+ float f;
+ int i;
+ void *p;
+};
+
+extern struct S *gp;
+int baz (float);
+
+static int
+__attribute__((noinline))
+bar (struct S *p)
+{
+ if (p->i != 6)
+ __builtin_abort ();
+
+ return baz(p->f);
+}
+
+int
+foo (void)
+{
+ struct S s;
+
+ gp = &s;
+ s.f = 7.4;
+ s.i = 6;
+ s.p = &s;
+
+ bar (&s);
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump-not "Variable constructed just to be passed to calls" "sra" } } */