+2020-02-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/93744
+ * match.pd (((m1 >/</>=/<= m2) * d -> (m1 >/</>=/<= m2) ? d : 0): For
+ GENERIC, make sure @2 in the first and @1 in the other patterns has no
+ side-effects.
+
2020-02-14 Eric Botcazou <ebotcazou@adacore.com>
PR target/93704
(for cmp (gt lt ge le)
(simplify
(mult (convert (cmp @0 @1)) @2)
- (cond (cmp @0 @1) @2 { build_zero_cst (type); })))
+ (if (GIMPLE || !TREE_SIDE_EFFECTS (@2))
+ (cond (cmp @0 @1) @2 { build_zero_cst (type); }))))
/* For integral types with undefined overflow and C != 0 fold
x * C EQ/NE y * C into x EQ/NE y. */
+2020-02-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/93744
+ * gcc.c-torture/execute/pr93744-1.c: New test.
+ * gcc.c-torture/execute/pr93744-2.c: New test.
+ * gcc.c-torture/execute/pr93744-3.c: New test.
+
2020-02-14 Jakub Jelinek <jakub@redhat.com>
PR c++/61414
--- /dev/null
+/* PR tree-optimization/93744 */
+
+typedef int I;
+
+int
+main ()
+{
+ int a = 0;
+ I b = 0;
+ (a > 0) * (b |= 2);
+ if (b != 2)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* PR tree-optimization/93744 */
+
+int w;
+
+int
+foo (int x, int y, int z)
+{
+ int r = z - ((z - w++) & -(x < y));
+ return r;
+}
+
+int
+main ()
+{
+ w = 4;
+ if (foo (5, 7, 12) != 4 || w != 5)
+ __builtin_abort ();
+ if (foo (7, 5, 12) != 12 || w != 6)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* PR tree-optimization/93744 */
+
+int w;
+
+int
+foo (int x, int y, int z)
+{
+ int r = z + ((w++ - z) & -(x < y));
+ return r;
+}
+
+int
+main ()
+{
+ w = 4;
+ if (foo (5, 7, 12) != 4 || w != 5)
+ __builtin_abort ();
+ if (foo (7, 5, 12) != 12 || w != 6)
+ __builtin_abort ();
+ return 0;
+}