This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, Pointer Bounds Checker 39/x] Avoid instrumented __builtin_unreachable calls
- From: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Jeff Law <law at redhat dot com>
- Date: Fri, 3 Oct 2014 13:01:25 +0400
- Subject: [PATCH, Pointer Bounds Checker 39/x] Avoid instrumented __builtin_unreachable calls
- Authentication-results: sourceware.org; auth=none
Hi,
This patch avoids generation of __builtin_unreachable calls marked as instrumented. It follows paradigma of no instrumented builtin calls (and passes corresponding assert in expand_builtin from patch #18).
Thanks,
Ilya
--
2014-10-01 Ilya Enkovich <ilya.enkovich@intel.com>
* cgraphunit.c (walk_polymorphic_call_targets): Do not mark
generated call to __builtin_unreachable as with_bounds.
* ipa.c (walk_polymorphic_call_targets): Likewise.
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index af90a79..d5e0075 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -866,6 +866,11 @@ walk_polymorphic_call_targets (hash_set<void *> *reachable_call_targets,
edge->make_direct (target);
edge->redirect_call_stmt_to_callee ();
+
+ /* Call to __builtin_unreachable shouldn't be instrumented. */
+ if (!targets.length ())
+ gimple_call_set_with_bounds (edge->call_stmt, false);
+
if (symtab->dump_file)
{
fprintf (symtab->dump_file,
diff --git a/gcc/ipa.c b/gcc/ipa.c
index 78f251a..7fc3429 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -209,7 +209,13 @@ walk_polymorphic_call_targets (hash_set<void *> *reachable_call_targets,
if (inline_summary_vec)
inline_update_overall_summary (node);
else if (edge->call_stmt)
- edge->redirect_call_stmt_to_callee ();
+ {
+ edge->redirect_call_stmt_to_callee ();
+
+ /* Call to __builtin_unreachable shouldn't be instrumented. */
+ if (!targets.length ())
+ gimple_call_set_with_bounds (edge->call_stmt, false);
+ }
}
}
}