Hi,

this patch makes HSAIL expansion ignore prefetch built-ins.  It is a bit
less straightforward because we also need to handle cases where the call
does not pass gimple_call_builtin_p test because of argument type
mismatches.

Committed to the branch, queued for merge to trunk soon.
Thanks,

Martin

2016-10-03  Martin Jambor  <mjam...@suse.cz>

        * hsa-gen.c (gen_hsa_insns_for_call): Ignore prefetch builtin.
---
 gcc/hsa-gen.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c
index ad40087..8893a28 100644
--- a/gcc/hsa-gen.c
+++ b/gcc/hsa-gen.c
@@ -5530,6 +5530,12 @@ gen_hsa_insns_for_call (gimple *stmt, hsa_bb *hbb)
   if (!gimple_call_builtin_p (stmt, BUILT_IN_NORMAL))
     {
       tree function_decl = gimple_call_fndecl (stmt);
+      /* Prefetch pass can create type-mismatching prefetch builtin calls which
+        fail the gimple_call_builtin_p test above.  Handle them here.  */
+      if (DECL_BUILT_IN_CLASS (function_decl)
+         && DECL_FUNCTION_CODE (function_decl) == BUILT_IN_PREFETCH)
+       return;
+
       if (function_decl == NULL_TREE)
        {
          HSA_SORRY_AT (gimple_location (stmt),
@@ -5962,6 +5968,8 @@ gen_hsa_insns_for_call (gimple *stmt, hsa_bb *hbb)
        gen_hsa_alloca (call, hbb);
        break;
       }
+    case BUILT_IN_PREFETCH:
+      break;
     default:
       {
        gen_hsa_insns_for_direct_call (stmt, hbb);
-- 
2.10.0

Reply via email to