clobber_info *
clobber_group::prev_clobber (insn_info *insn) const
{
- auto &tree = const_cast<clobber_tree &> (m_clobber_tree);
- int comparison = lookup_clobber (tree, insn);
+ int comparison = lookup_clobber (insn);
if (comparison <= 0)
- return dyn_cast<clobber_info *> (tree.root ()->prev_def ());
- return tree.root ();
+ return dyn_cast<clobber_info *> (m_clobber_tree.root ()->prev_def ());
+ return m_clobber_tree.root ();
}
// See the comment above the declaration.
clobber_info *
clobber_group::next_clobber (insn_info *insn) const
{
- auto &tree = const_cast<clobber_tree &> (m_clobber_tree);
- int comparison = lookup_clobber (tree, insn);
+ int comparison = lookup_clobber (insn);
if (comparison >= 0)
- return dyn_cast<clobber_info *> (tree.root ()->next_def ());
- return tree.root ();
+ return dyn_cast<clobber_info *> (m_clobber_tree.root ()->next_def ());
+ return m_clobber_tree.root ();
}
// See the comment above the declaration.
pp_indentation (pp) -= 4;
}
+// A wrapper around rtl_ssa::lookup_clobber that ensures that the root
+// of the splay tree always has the correct group.
+int
+clobber_group::lookup_clobber (insn_info *insn) const
+{
+ auto &tree = const_cast<clobber_tree &> (m_clobber_tree);
+ int result = rtl_ssa::lookup_clobber (tree, insn);
+ tree->update_group (const_cast<clobber_group *> (this));
+ return result;
+}
+
// See the comment above the declaration.
def_info *
def_lookup::prev_def (insn_info *insn) const
// Search for either the previous or next clobber in the group.
// The result is less than zero if CLOBBER should come before NEIGHBOR
// or greater than zero if CLOBBER should come after NEIGHBOR.
- int comparison = lookup_clobber (group->m_clobber_tree, clobber->insn ());
+ int comparison = group->lookup_clobber (clobber->insn ());
gcc_checking_assert (comparison != 0);
clobber_info *neighbor = group->m_clobber_tree.root ();
- // Since HEIGHBOR is now the root of the splay tree, its group needs
- // to be up-to-date.
- neighbor->update_group (group);
-
// If CLOBBER comes before NEIGHBOR, insert CLOBBER to NEIGHBOR's left,
// otherwise insert CLOBBER to NEIGHBOR's right.
clobber_info::splay_tree::insert_child (neighbor, comparison > 0, clobber);
--- /dev/null
+// { dg-require-effective-target shared }
+// { dg-require-effective-target lto }
+// { dg-options "-O2 -flto -shared" }
+
+struct QAbstractFileEngine {
+ virtual bool seek(long long);
+};
+struct QQmlPreviewFileEngine : QAbstractFileEngine {
+ bool seek(long long);
+ int m_contents;
+ QAbstractFileEngine * m_fallback;
+};
+bool f(void*);
+bool QQmlPreviewFileEngine::seek(long long newPos) {
+ if (m_fallback)
+ return m_fallback->seek(newPos);
+ else
+ return f(&m_contents);
+}