diff options
Diffstat (limited to 'gcc/lto-streamer-in.c')
-rw-r--r-- | gcc/lto-streamer-in.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index 9b785ff..a313b25 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -1136,41 +1136,47 @@ input_function (tree fn_decl, struct data_in *data_in, if (is_gimple_call (stmt) && gimple_call_internal_p (stmt)) { + bool replace = false; switch (gimple_call_internal_fn (stmt)) { case IFN_UBSAN_NULL: if ((flag_sanitize & (SANITIZE_NULL | SANITIZE_ALIGNMENT)) == 0) - remove = true; + replace = true; break; case IFN_UBSAN_BOUNDS: if ((flag_sanitize & SANITIZE_BOUNDS) == 0) - remove = true; + replace = true; break; case IFN_UBSAN_VPTR: if ((flag_sanitize & SANITIZE_VPTR) == 0) - remove = true; + replace = true; break; case IFN_UBSAN_OBJECT_SIZE: if ((flag_sanitize & SANITIZE_OBJECT_SIZE) == 0) - remove = true; + replace = true; break; case IFN_UBSAN_PTR: if ((flag_sanitize & SANITIZE_POINTER_OVERFLOW) == 0) - remove = true; + replace = true; break; case IFN_ASAN_MARK: if ((flag_sanitize & SANITIZE_ADDRESS) == 0) - remove = true; + replace = true; break; case IFN_TSAN_FUNC_EXIT: if ((flag_sanitize & SANITIZE_THREAD) == 0) - remove = true; + replace = true; break; default: break; } - gcc_assert (!remove || gimple_call_lhs (stmt) == NULL_TREE); + if (replace) + { + gimple_call_set_internal_fn (as_a <gcall *> (stmt), + IFN_NOP); + update_stmt (stmt); + } } } if (remove) |