diff mbox

[match-and-simplify] Use gimple_simplify for call simplification in SCCVN

Message ID alpine.LSU.2.11.1408070941440.20733@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Aug. 7, 2014, 7:42 a.m. UTC
This is a last spot I forgot that sill does GENERIC building/folding
in SCCVN.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2014-08-07  Richard Biener  <rguenther@suse.de>

	* tree-ssa-sccvn.c (fully_constant_vn_reference_p): Use
	gimple_simplify instead of building a GENERIC call expr.
diff mbox

Patch

Index: gcc/tree-ssa-sccvn.c
===================================================================
--- gcc/tree-ssa-sccvn.c	(revision 213697)
+++ gcc/tree-ssa-sccvn.c	(working copy)
@@ -1236,7 +1236,7 @@  fully_constant_vn_reference_p (vn_refere
   if (op->opcode == CALL_EXPR
       && TREE_CODE (op->op0) == ADDR_EXPR
       && TREE_CODE (TREE_OPERAND (op->op0, 0)) == FUNCTION_DECL
-      && DECL_BUILT_IN (TREE_OPERAND (op->op0, 0))
+      && DECL_BUILT_IN_CLASS (TREE_OPERAND (op->op0, 0)) == BUILT_IN_NORMAL
       && operands.length () >= 2
       && operands.length () <= 3)
     {
@@ -1256,13 +1256,15 @@  fully_constant_vn_reference_p (vn_refere
 	anyconst = true;
       if (anyconst)
 	{
-	  tree folded = build_call_expr (TREE_OPERAND (op->op0, 0),
-					 arg1 ? 2 : 1,
-					 arg0->op0,
-					 arg1 ? arg1->op0 : NULL);
-	  if (folded
-	      && TREE_CODE (folded) == NOP_EXPR)
-	    folded = TREE_OPERAND (folded, 0);
+	  enum built_in_function fcode
+	    = DECL_FUNCTION_CODE (TREE_OPERAND (op->op0, 0));
+	  tree folded;
+	  if (arg1)
+	    folded = gimple_simplify (fcode, op->type, arg0->op0, arg1->op0,
+				      NULL, vn_valueize);
+	  else
+	    folded = gimple_simplify (fcode, op->type, arg0->op0,
+				      NULL, vn_valueize);
 	  if (folded
 	      && is_gimple_min_invariant (folded))
 	    return folded;