diff options
author | ienkovich <ienkovich@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-11-24 09:45:20 +0000 |
---|---|---|
committer | ienkovich <ienkovich@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-11-24 09:45:20 +0000 |
commit | 57cbac18a7190903d338b17262f82890fd8bb581 (patch) | |
tree | 3418f5bf30bacb63903659e0d25d3b02c74fb671 /gcc/gimple-fold.c | |
parent | 43ada4d7e5a7a78563a26825914986fa4f5a7736 (diff) | |
download | gcc-57cbac18a7190903d338b17262f82890fd8bb581.tar.gz |
gcc/
PR c/68337
* gimple-fold.c: Include ipa-chkp.h.
(gimple_fold_builtin_memory_op): Don't fold call if we
are going to instrument it and it may copy pointers.
gcc/testsuite/
PR c/68337
* gcc.target/i386/mpx/pr68337-1.c: New test.
* gcc.target/i386/mpx/pr68337-2.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230796 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r-- | gcc/gimple-fold.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 1ab20d11fa7..6ff5e266d42 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -53,6 +53,7 @@ along with GCC; see the file COPYING3. If not see #include "gomp-constants.h" #include "optabs-query.h" #include "omp-low.h" +#include "ipa-chkp.h" /* Return true when DECL can be referenced from current unit. @@ -664,6 +665,18 @@ gimple_fold_builtin_memory_op (gimple_stmt_iterator *gsi, unsigned int src_align, dest_align; tree off0; + /* Inlining of memcpy/memmove may cause bounds lost (if we copy + pointers as wide integer) and also may result in huge function + size because of inlined bounds copy. Thus don't inline for + functions we want to instrument. */ + if (flag_check_pointer_bounds + && chkp_instrumentable_p (cfun->decl) + /* Even if data may contain pointers we can inline if copy + less than a pointer size. */ + && (!tree_fits_uhwi_p (len) + || compare_tree_int (len, POINTER_SIZE_UNITS) >= 0)) + return false; + /* Build accesses at offset zero with a ref-all character type. */ off0 = build_int_cst (build_pointer_type_for_mode (char_type_node, ptr_mode, true), 0); |