+2016-07-25 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2016-07-14 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ PR tree-optimization/81162
+ * gimple-ssa-strength-reduction.c (replace_mult_candidate): Don't
+ replace a negate with an add.
+
2017-07-24 Uros Bizjak <ubizjak@gmail.com>
PR target/80569
types but allows for safe negation without twisted logic. */
if (wi::fits_shwi_p (bump)
&& bump.to_shwi () != HOST_WIDE_INT_MIN
- /* It is not useful to replace casts, copies, or adds of
+ /* It is not useful to replace casts, copies, negates, or adds of
an SSA name and a constant. */
&& cand_code != MODIFY_EXPR
&& !CONVERT_EXPR_CODE_P (cand_code)
&& cand_code != PLUS_EXPR
&& cand_code != POINTER_PLUS_EXPR
- && cand_code != MINUS_EXPR)
+ && cand_code != MINUS_EXPR
+ && cand_code != NEGATE_EXPR)
{
enum tree_code code = PLUS_EXPR;
tree bump_tree;
+2016-07-25 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2016-07-14 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ PR tree-optimization/81162
+ * gcc.dg/ubsan/pr81162.c: New file.
+
2017-07-24 Uros Bizjak <ubizjak@gmail.com>
PR target/80569
--- /dev/null
+/* PR tree-optimization/81162 */
+/* { dg-do run } */
+/* { dg-options "-fsanitize=undefined -O2" } */
+
+short s;
+int i1 = 1;
+int i2 = 1;
+unsigned char uc = 147;
+
+int main() {
+ s = (-uc + 2147483647) << 0;
+ if (9031239389974324562ULL >= (-((i1 && i2) + uc) ^ -21096) ) {
+ return 0;
+ } else {
+ return -1;
+ }
+}