+2019-11-15 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/92039
+ PR tree-optimization/91975
+ * tree-ssa-loop-ivcanon.c (constant_after_peeling): Revert
+ previous change, treat invariants consistently as non-constant.
+ (tree_estimate_loop_size): Ternary ops with just the first op
+ constant are not optimized away.
+
2019-11-15 Jakub Jelinek <jakub@redhat.com>
* gimplify.c (gimplify_call_expr): Don't call
+2019-11-15 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/92039
+ PR tree-optimization/91975
+ * gcc.dg/tree-ssa/cunroll-2.c: Revert to state previous to
+ unroller adjustment.
+ * g++.dg/tree-ssa/ivopts-3.C: Likewise.
+
2019-11-15 Jakub Jelinek <jakub@redhat.com>
* c-c++-common/gomp/declare-variant-13.c: New test.
return 0;
}
-// Verify that on x86_64 and i?86 we unroll the innsermost loop and
-// use three IVs for the then innermost loop
+// Verify that on x86_64 and i?86 we use a single IV for the innermost loop
-// { dg-final { scan-tree-dump "Selected IV set for loop \[0-9\]* at \[^ \]*:63, 127 avg niters, 3 IVs" "ivopts" { target x86_64-*-* i?86-*-* } } }
-// { dg-final { scan-tree-dump-not "Selected IV set for loop \[0-9\]* at \[^ \]*:64" "ivopts" { target x86_64-*-* i?86-*-* } } }
+// { dg-final { scan-tree-dump "Selected IV set for loop \[0-9\]* at \[^ \]*:64, 3 avg niters, 1 IVs" "ivopts" { target x86_64-*-* i?86-*-* } } }
/* { dg-do compile } */
-/* { dg-options "-O3 -fdump-tree-cunrolli-details" } */
+/* { dg-options "-O3 -fdump-tree-cunroll-details" } */
int a[2];
int test2 (void);
void
}
}
/* We are not able to get rid of the final conditional because the loop has two exits. */
-/* { dg-final { scan-tree-dump "loop with 2 iterations completely unrolled" "cunrolli"} } */
+/* { dg-final { scan-tree-dump "loop with 1 iterations completely unrolled" "cunroll"} } */
static bool
constant_after_peeling (tree op, gimple *stmt, class loop *loop)
{
- if (is_gimple_min_invariant (op))
+ if (CONSTANT_CLASS_P (op))
return true;
/* We can still fold accesses to constant arrays when index is known. */
/* Induction variables are constants when defined in loop. */
if (loop_containing_stmt (stmt) != loop)
return false;
- tree ev = instantiate_parameters (loop, analyze_scalar_evolution (loop, op));
- if (chrec_contains_undetermined (ev))
+ tree ev = analyze_scalar_evolution (loop, op);
+ if (chrec_contains_undetermined (ev)
+ || chrec_contains_symbols (ev))
return false;
return true;
}
stmt, loop)
&& (gimple_assign_rhs_class (stmt) != GIMPLE_BINARY_RHS
|| constant_after_peeling (gimple_assign_rhs2 (stmt),
- stmt, loop)))
+ stmt, loop))
+ && gimple_assign_rhs_class (stmt) != GIMPLE_TERNARY_RHS)
{
size->constant_iv = true;
if (dump_file && (dump_flags & TDF_DETAILS))