The jump threading code requires marked irreducible regions for the
purpose of validating jump threading paths but DOM fails to provide
that resulting in mised number of iteration upper bounds clearing.
2021-06-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/100934
* tree-ssa-dom.c (pass_dominator::execute): Properly
mark irreducible regions.
* gcc.dg/torture/pr100934.c: New testcase.
--- /dev/null
+/* { dg-do run } */
+
+int a, b, c, d, e;
+int main()
+{
+ int f = 0, g = 0;
+ for (; f < 2; f++)
+ {
+ int h, i;
+ for (h = 0; h < 2; h++)
+ {
+ b = e = g ? a % g : 0;
+ c = d;
+ for (i = 0; i < 1; i++)
+ g = 0;
+ for (; g < 2; g++)
+ ;
+ }
+ }
+ return 0;
+}
gcc.dg/tree-ssa/pr21417.c can't be threaded if loop preheader is
missing. We should improve jump threading in future then
LOOPS_HAVE_PREHEADERS won't be needed here. */
- loop_optimizer_init (LOOPS_HAVE_PREHEADERS | LOOPS_HAVE_SIMPLE_LATCHES);
+ loop_optimizer_init (LOOPS_HAVE_PREHEADERS | LOOPS_HAVE_SIMPLE_LATCHES
+ | LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS);
/* We need accurate information regarding back edges in the CFG
for jump threading; this may include back edges that are not part of