Discussion:
[PATCH, Pointer Bounds Checker 39/x] Avoid instrumented __builtin_unreachable calls
Ilya Enkovich
2014-10-03 09:01:25 UTC
Permalink
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 <***@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);
+ }
}
}
}
Jeff Law
2014-10-03 15:50:52 UTC
Permalink
Post by Ilya Enkovich
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
--
* cgraphunit.c (walk_polymorphic_call_targets): Do not mark
generated call to __builtin_unreachable as with_bounds.
* ipa.c (walk_polymorphic_call_targets): Likewise.
OK. However, if we find many more generated calls to builtins that need
to be marked this way, then we'll probably want to put the logic into
the expander code rather than hacking up each instance individually.

jeff

Loading...