diff mbox

[RFC] Expensive internal function calls.

Message ID HE1PR0801MB27467AF27A4785673DB0B885E7800@HE1PR0801MB2746.eurprd08.prod.outlook.com
State New
Headers show

Commit Message

Bin Cheng Aug. 18, 2017, 8:45 a.m. UTC
Hi,
As a followup patch for fix to PR81832, this patch considers internal function call to
IFN_LOOP_DIST_ALIAS and IFN_LOOP_VECTORIZED as expensive.  Or interpreted
in another way: return false since we shouldn't be asked the question?  Any comments?
BTW, I have no problem to drop this if not appropriate.

Thanks,
bin
2017-08-16  Bin Cheng  <bin.cheng@arm.com>

	* gimple.c (gimple_inexpensive_call_p): Consider IFN_LOOP_DIST_ALIAS
	and IFN_LOOP_VECTORIZED as expensive calls.

Comments

Richard Biener Aug. 18, 2017, 9:23 a.m. UTC | #1
On Fri, Aug 18, 2017 at 10:45 AM, Bin Cheng <Bin.Cheng@arm.com> wrote:
> Hi,
> As a followup patch for fix to PR81832, this patch considers internal function call to
> IFN_LOOP_DIST_ALIAS and IFN_LOOP_VECTORIZED as expensive.  Or interpreted
> in another way: return false since we shouldn't be asked the question?  Any comments?
> BTW, I have no problem to drop this if not appropriate.

I think as the meaning is to cost the actual call making it expensive
is wrong given it
will end up as constant.  So, no, this doesn't look correct.

Richard.

> Thanks,
> bin
> 2017-08-16  Bin Cheng  <bin.cheng@arm.com>
>
>         * gimple.c (gimple_inexpensive_call_p): Consider IFN_LOOP_DIST_ALIAS
>         and IFN_LOOP_VECTORIZED as expensive calls.
diff mbox

Patch

diff --git a/gcc/gimple.c b/gcc/gimple.c
index c4e6f81..6d4e376 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -3038,7 +3038,16 @@  bool
 gimple_inexpensive_call_p (gcall *stmt)
 {
   if (gimple_call_internal_p (stmt))
-    return true;
+    {
+      /* Some internal function calls are only meant to indicate temporary
+	 arrangement of optimization and are never used in code generation.
+	 We always consider these calls expensive.  */
+      if (gimple_call_internal_p (stmt, IFN_LOOP_DIST_ALIAS)
+	  || gimple_call_internal_p (stmt, IFN_LOOP_VECTORIZED))
+	return false;
+
+      return true;
+    }
   tree decl = gimple_call_fndecl (stmt);
   if (decl && is_inexpensive_builtin (decl))
     return true;