tree-ssa-sccvn.c (vn_nary_op_eq): Check BIT_INSERT_EXPR's operand 1 to see if the...
authorAndrew Pinski <apinski@cavium.com>
Fri, 21 Jul 2017 17:16:51 +0000 (17:16 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Fri, 21 Jul 2017 17:16:51 +0000 (10:16 -0700)
2017-07-21  Andrew Pinski  <apinski@cavium.com>

        * tree-ssa-sccvn.c (vn_nary_op_eq): Check BIT_INSERT_EXPR's
        operand 1 to see if the types precision matches.
        * fold-const.c (operand_equal_p): Likewise.

From-SVN: r250431

gcc/ChangeLog
gcc/fold-const.c
gcc/tree-ssa-sccvn.c

index 96f89f4eb76d87d4b9e7e4ab136adab074dc639f..2033b33789f440bec7de59b2be0466c1fe1329f9 100644 (file)
@@ -1,3 +1,9 @@
+2017-07-21  Andrew Pinski  <apinski@cavium.com>
+
+       * tree-ssa-sccvn.c (vn_nary_op_eq): Check BIT_INSERT_EXPR's
+       operand 1 to see if the types precision matches.
+       * fold-const.c (operand_equal_p): Likewise.
+
 2017-07-21  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/81303
index d702de2f97f07621e53eb853b1143d14a2d36714..c061f3e2f89264e28fc40080ef46f1f88af5e0aa 100644 (file)
@@ -3184,9 +3184,18 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
          flags &= ~OEP_ADDRESS_OF;
          return OP_SAME (0);
 
+       case BIT_INSERT_EXPR:
+         /* BIT_INSERT_EXPR has an implict operand as the type precision
+            of op1.  Need to check to make sure they are the same.  */
+         if (TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST
+             && TREE_CODE (TREE_OPERAND (arg1, 1)) == INTEGER_CST
+             && TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg0, 1)))
+                != TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg1, 1))))
+           return false;
+         /* FALLTHRU */
+
        case VEC_COND_EXPR:
        case DOT_PROD_EXPR:
-       case BIT_INSERT_EXPR:
          return OP_SAME (0) && OP_SAME (1) && OP_SAME (2);
 
        case MODIFY_EXPR:
index 324cd73f513eb8b860f072825ccc191f27859947..ca43f01b1f5054b5b4a7fc0f7832ee7b4ccd7036 100644 (file)
@@ -2636,6 +2636,14 @@ vn_nary_op_eq (const_vn_nary_op_t const vno1, const_vn_nary_op_t const vno2)
     if (!expressions_equal_p (vno1->op[i], vno2->op[i]))
       return false;
 
+  /* BIT_INSERT_EXPR has an implict operand as the type precision
+     of op1.  Need to check to make sure they are the same.  */
+  if (vno1->opcode == BIT_INSERT_EXPR
+      && TREE_CODE (vno1->op[1]) == INTEGER_CST
+      && TYPE_PRECISION (TREE_TYPE (vno1->op[1]))
+        != TYPE_PRECISION (TREE_TYPE (vno2->op[1])))
+    return false;
+
   return true;
 }