diff mbox series

Add missing gimple_call_set_fntype

Message ID ri636g81wxn.fsf@suse.cz
State New
Headers show
Series Add missing gimple_call_set_fntype | expand

Commit Message

Martin Jambor Oct. 4, 2019, 1:07 p.m. UTC
Hi,

when looking for detected call argument type incompatibilities I
stumbled over a call to builtin_memcpy which originally was a call to
builtin_memset but simplify_builtin_call changed it to the former
without setting the gimple statement fntype.  That's probably not a big
deal but since I know about it I thought I might as well make the
statement consistent with the following.

Bootstrapped and tested on x86-64-linux.  OK for trunk?

Thanks,

Martin


2019-10-04  Martin Jambor  <mjambor@suse.cz>

	* tree-ssa-forwprop.c (simplify_builtin_call): Set gimple call
	fntype when switching to calling memcpy instead of memset.
---
 gcc/tree-ssa-forwprop.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Jeff Law Oct. 4, 2019, 3:39 p.m. UTC | #1
On 10/4/19 7:07 AM, Martin Jambor wrote:
> Hi,
> 
> when looking for detected call argument type incompatibilities I
> stumbled over a call to builtin_memcpy which originally was a call to
> builtin_memset but simplify_builtin_call changed it to the former
> without setting the gimple statement fntype.  That's probably not a big
> deal but since I know about it I thought I might as well make the
> statement consistent with the following.
> 
> Bootstrapped and tested on x86-64-linux.  OK for trunk?
> 
> Thanks,
> 
> Martin
> 
> 
> 2019-10-04  Martin Jambor  <mjambor@suse.cz>
> 
> 	* tree-ssa-forwprop.c (simplify_builtin_call): Set gimple call
> 	fntype when switching to calling memcpy instead of memset.
OK
jeff
diff mbox series

Patch

diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 221f140b356..a1e22c93631 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -1426,8 +1426,10 @@  simplify_builtin_call (gimple_stmt_iterator *gsi_p, tree callee2)
 	      if (!is_gimple_val (ptr1))
 		ptr1 = force_gimple_operand_gsi (gsi_p, ptr1, true, NULL_TREE,
 						 true, GSI_SAME_STMT);
-	      gimple_call_set_fndecl (stmt2,
-				      builtin_decl_explicit (BUILT_IN_MEMCPY));
+	      tree fndecl = builtin_decl_explicit (BUILT_IN_MEMCPY);
+	      gimple_call_set_fndecl (stmt2, fndecl);
+	      gimple_call_set_fntype (as_a <gcall *> (stmt2),
+				      TREE_TYPE (fndecl));
 	      gimple_call_set_arg (stmt2, 0, ptr1);
 	      gimple_call_set_arg (stmt2, 1, new_str_cst);
 	      gimple_call_set_arg (stmt2, 2,