aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ipa-sra.cc11
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr110276.c15
2 files changed, 26 insertions, 0 deletions
diff --git a/gcc/ipa-sra.cc b/gcc/ipa-sra.cc
index 3fee8fb..21d281a 100644
--- a/gcc/ipa-sra.cc
+++ b/gcc/ipa-sra.cc
@@ -3074,6 +3074,8 @@ struct caller_issues
cgraph_node *candidate;
/* There is a thunk among callers. */
bool thunk;
+ /* Set if there is at least one caller that is OK. */
+ bool there_is_one;
/* Call site with no available information. */
bool unknown_callsite;
/* Call from outside the candidate's comdat group. */
@@ -3116,6 +3118,8 @@ check_for_caller_issues (struct cgraph_node *node, void *data)
if (csum->m_bit_aligned_arg)
issues->bit_aligned_aggregate_argument = true;
+
+ issues->there_is_one = true;
}
return false;
}
@@ -3170,6 +3174,13 @@ check_all_callers_for_issues (cgraph_node *node)
for (unsigned i = 0; i < param_count; i++)
(*ifs->m_parameters)[i].split_candidate = false;
}
+ if (!issues.there_is_one)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "There is no call to %s that we can modify. "
+ "Disabling all modifications.\n", node->dump_name ());
+ return true;
+ }
return false;
}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr110276.c b/gcc/testsuite/gcc.dg/ipa/pr110276.c
new file mode 100644
index 0000000..5a1e2f3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr110276.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef long (*EFI_PCI_IO_PROTOCOL_CONFIG)();
+typedef struct {
+ EFI_PCI_IO_PROTOCOL_CONFIG Read;
+} EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS;
+typedef struct {
+ EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS Pci;
+} EFI_PCI_IO_PROTOCOL;
+int init_regs_0;
+static void __attribute__((constructor)) init(EFI_PCI_IO_PROTOCOL *pci_io) {
+ if (init_regs_0)
+ pci_io->Pci.Read();
+}