Maximum number of dominators BBs to walk when simplifying loop bounds
and conditions.
+@paindex dom-jump-threading
+@item dom-jump-threading
+Enable jump threading in the dominator optimizer pass. Disabling it
+is useful to isolate the jump threads found by the backward threader,
+which runs regardless.
+
@paindex max-jump-thread-duplication-stmts
@item max-jump-thread-duplication-stmts
Maximum number of statements allowed in a block that needs to be
Common Joined UInteger Var(param_cxx_max_namespaces_for_diagnostic_help) Init(1000) Param
Maximum number of namespaces to search for alternatives when name lookup fails.
+-param=dom-jump-threading=
+Common Joined UInteger Var(param_dom_jump_threading) Init(1) IntegerRange(0, 1) Param Optimization
+Enable jump threading in the dominator optimizer pass.
+
-param=dse-max-alias-queries-per-store=
Common Joined UInteger Var(param_dse_max_alias_queries_per_store) Init(256) Param Optimization
Maximum number of queries into the alias oracle per store.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 --param=dom-jump-threading=0 -fdump-tree-dom2-details -fdump-tree-optimized" } */
+
+/* Verify that --param=dom-jump-threading=0 keeps DOM from threading
+ jumps. Only DOM can thread a PHI of compares (the backward
+ threader cannot resolve the exit conditional to a single edge), so
+ with the param off the join block and its PHI must survive. */
+
+void g (void);
+
+void
+f (int x, int a, int b, int c, int d)
+{
+ _Bool t;
+ if (x)
+ t = a < b;
+ else
+ t = c < d;
+ if (t)
+ g ();
+}
+
+/* { dg-final { scan-tree-dump-not "Registering jump thread" "dom2" } } */
+/* { dg-final { scan-tree-dump "PHI <" "optimized" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-dom2-details" } */
+
+/* Same test as dom-jump-threading-1.c but with DOM jump threading at
+ its default (enabled): DOM must thread the PHI of compares, which
+ keeps the sibling test honest. */
+
+void g (void);
+
+void
+f (int x, int a, int b, int c, int d)
+{
+ _Bool t;
+ if (x)
+ t = a < b;
+ else
+ t = c < d;
+ if (t)
+ g ();
+}
+
+/* { dg-final { scan-tree-dump "Registering jump thread" "dom2" } } */
void
dom_opt_dom_walker::after_dom_children (basic_block bb)
{
- m_threader->thread_outgoing_edges (bb);
+ if (param_dom_jump_threading)
+ m_threader->thread_outgoing_edges (bb);
bitmap_clear_bit (m_state->get_blocks_on_stack (), bb->index);
m_avail_exprs_stack->pop_to_marker ();
m_const_and_copies->pop_to_marker ();