2017-05-10 Richard Biener <rguenther@suse.de>

Backport from mainline
	2017-03-17  Richard Biener  <rguenther@suse.de>

	PR middle-end/80075
	* tree-eh.c (stmt_could_throw_1_p): Only handle gimple assigns.
	Properly verify the LHS before the RHS possibly claims to be
	handled.
	(stmt_could_throw_p): Hande gimple conds fully here.  Clobbers
	do not throw.

	* g++.dg/torture/pr80075.C: New testcase.

	2017-03-21  Brad Spengler <spender@grsecurity.net>

	PR plugin/80094
	* plugin.c (htab_hash_plugin): New function.
	(add_new_plugin): Use it and adjust.
	(parse_plugin_arg_opt): Adjust.
	(init_one_plugin): Likewise.

	2017-03-20  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/80113
	* graphite-isl-ast-to-gimple.c (copy_loop_phi_nodes): Do not
	allocate extra SSA name for PHI def.
	(add_close_phis_to_outer_loops): Likewise.
	(add_close_phis_to_merge_points): Likewise.
	(copy_loop_close_phi_args): Likewise.
	(copy_cond_phi_nodes): Likewise.

	2017-03-21  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/80122
	* tree-inline.c (copy_bb): Do not expans va-arg packs or
	va_arg_pack_len when the inlined call stmt requires pack
	expansion itself.
	* tree-inline.h (struct copy_body_data): Make call_stmt a gcall *.

	* gcc.dg/torture/pr80122.c: New testcase.

	2017-03-24  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/80167
	* graphite-isl-ast-to-gimple.c
	(translate_isl_ast_to_gimple::is_valid_rename): Handle default-defs
	properly.
	(translate_isl_ast_to_gimple::get_rename): Likewise.

	* gcc.dg/graphite/pr80167.c: New testcase.

	2017-03-27  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/80170
	* tree-vect-data-refs.c (vect_compute_data_ref_alignment): Make
	sure DR/SCEV didnt fold in constants we do not see when looking
	at the reference base alignment.

	2017-03-27  Richard Biener  <rguenther@suse.de>

	PR middle-end/80171
	* gimple-fold.c (fold_ctor_reference): Properly guard against
	NULL return value from canonicalize_constructor_val.

	* g++.dg/torture/pr80171.C: New testcase.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-6-branch@247826 138bc75d-0d04-0410-961f-82ee72b054a4
This commit is contained in:
rguenth 2017-05-10 07:44:41 +00:00
parent 0e990162fc
commit 4d32cb520d
13 changed files with 443 additions and 31 deletions

View File

@ -1,3 +1,62 @@
2017-05-10 Richard Biener <rguenther@suse.de>
Backport from mainline
2017-03-17 Richard Biener <rguenther@suse.de>
PR middle-end/80075
* tree-eh.c (stmt_could_throw_1_p): Only handle gimple assigns.
Properly verify the LHS before the RHS possibly claims to be
handled.
(stmt_could_throw_p): Hande gimple conds fully here. Clobbers
do not throw.
2017-03-21 Brad Spengler <spender@grsecurity.net>
PR plugin/80094
* plugin.c (htab_hash_plugin): New function.
(add_new_plugin): Use it and adjust.
(parse_plugin_arg_opt): Adjust.
(init_one_plugin): Likewise.
2017-03-20 Richard Biener <rguenther@suse.de>
PR tree-optimization/80113
* graphite-isl-ast-to-gimple.c (copy_loop_phi_nodes): Do not
allocate extra SSA name for PHI def.
(add_close_phis_to_outer_loops): Likewise.
(add_close_phis_to_merge_points): Likewise.
(copy_loop_close_phi_args): Likewise.
(copy_cond_phi_nodes): Likewise.
2017-03-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/80122
* tree-inline.c (copy_bb): Do not expans va-arg packs or
va_arg_pack_len when the inlined call stmt requires pack
expansion itself.
* tree-inline.h (struct copy_body_data): Make call_stmt a gcall *.
2017-03-24 Richard Biener <rguenther@suse.de>
PR tree-optimization/80167
* graphite-isl-ast-to-gimple.c
(translate_isl_ast_to_gimple::is_valid_rename): Handle default-defs
properly.
(translate_isl_ast_to_gimple::get_rename): Likewise.
2017-03-27 Richard Biener <rguenther@suse.de>
PR tree-optimization/80170
* tree-vect-data-refs.c (vect_compute_data_ref_alignment): Make
sure DR/SCEV didnt fold in constants we do not see when looking
at the reference base alignment.
2017-03-27 Richard Biener <rguenther@suse.de>
PR middle-end/80171
* gimple-fold.c (fold_ctor_reference): Properly guard against
NULL return value from canonicalize_constructor_val.
2017-05-09 Richard Biener <rguenther@suse.de>
Backport from mainline

View File

@ -5506,9 +5506,12 @@ fold_ctor_reference (tree type, tree ctor, unsigned HOST_WIDE_INT offset,
&& !compare_tree_int (TYPE_SIZE (TREE_TYPE (ctor)), size))
{
ret = canonicalize_constructor_val (unshare_expr (ctor), from_decl);
ret = fold_unary (VIEW_CONVERT_EXPR, type, ret);
if (ret)
STRIP_USELESS_TYPE_CONVERSION (ret);
{
ret = fold_unary (VIEW_CONVERT_EXPR, type, ret);
if (ret)
STRIP_USELESS_TYPE_CONVERSION (ret);
}
return ret;
}
/* For constants and byte-aligned/sized reads try to go through

View File

@ -1157,6 +1157,9 @@ bool translate_isl_ast_to_gimple::
is_valid_rename (tree rename, basic_block def_bb, basic_block use_bb,
phi_node_kind phi_kind, tree old_name, basic_block old_bb) const
{
if (SSA_NAME_IS_DEFAULT_DEF (rename))
return true;
/* The def of the rename must either dominate the uses or come from a
back-edge. Also the def must respect the loop closed ssa form. */
if (!is_loop_closed_ssa_use (use_bb, rename))
@ -1212,6 +1215,7 @@ get_rename (basic_block new_bb, tree old_name, basic_block old_bb,
basic_block bb = gimple_bb (SSA_NAME_DEF_STMT (rename));
if (is_valid_rename (rename, bb, new_bb, phi_kind, old_name, old_bb)
&& (phi_kind == close_phi
|| ! bb
|| flow_bb_inside_loop_p (bb->loop_father, new_bb)))
return rename;
return NULL_TREE;
@ -1913,7 +1917,7 @@ copy_loop_phi_nodes (basic_block bb, basic_block new_bb)
if (is_gimple_reg (res) && scev_analyzable_p (res, region->region))
continue;
gphi *new_phi = create_phi_node (SSA_NAME_VAR (res), new_bb);
gphi *new_phi = create_phi_node (NULL_TREE, new_bb);
tree new_res = create_new_def_for (res, new_phi,
gimple_phi_result_ptr (new_phi));
set_rename (res, new_res);
@ -2013,7 +2017,7 @@ add_close_phis_to_outer_loops (tree last_merge_name, edge last_e,
if (!bb_contains_loop_close_phi_nodes (bb) || !single_succ_p (bb))
bb = split_edge (e);
gphi *close_phi = create_phi_node (SSA_NAME_VAR (last_merge_name), bb);
gphi *close_phi = create_phi_node (NULL_TREE, bb);
tree res = create_new_def_for (last_merge_name, close_phi,
gimple_phi_result_ptr (close_phi));
set_rename (old_close_phi_name, res);
@ -2058,7 +2062,7 @@ add_close_phis_to_merge_points (gphi *old_close_phi, gphi *new_close_phi,
last_merge_name = add_close_phis_to_outer_loops (last_merge_name, merge_e,
old_close_phi);
gphi *merge_phi = create_phi_node (SSA_NAME_VAR (old_close_phi_name), new_merge_bb);
gphi *merge_phi = create_phi_node (NULL_TREE, new_merge_bb);
tree merge_res = create_new_def_for (old_close_phi_name, merge_phi,
gimple_phi_result_ptr (merge_phi));
set_rename (old_close_phi_name, merge_res);
@ -2111,7 +2115,7 @@ copy_loop_close_phi_args (basic_block old_bb, basic_block new_bb, bool postpone)
/* Loop close phi nodes should not be scev_analyzable_p. */
gcc_unreachable ();
gphi *new_close_phi = create_phi_node (SSA_NAME_VAR (res), new_bb);
gphi *new_close_phi = create_phi_node (NULL_TREE, new_bb);
tree new_res = create_new_def_for (res, new_close_phi,
gimple_phi_result_ptr (new_close_phi));
set_rename (res, new_res);
@ -2494,7 +2498,7 @@ copy_cond_phi_nodes (basic_block bb, basic_block new_bb, vec<tree> iv_map)
if (virtual_operand_p (res))
continue;
gphi *new_phi = create_phi_node (SSA_NAME_VAR (res), new_bb);
gphi *new_phi = create_phi_node (NULL_TREE, new_bb);
tree new_res = create_new_def_for (res, new_phi,
gimple_phi_result_ptr (new_phi));
set_rename (res, new_res);

View File

@ -114,6 +114,16 @@ static const char *str_plugin_init_func_name = "plugin_init";
static const char *str_license = "plugin_is_GPL_compatible";
#endif
/* Helper function for hashing the base_name of the plugin_name_args
structure to be inserted into the hash table. */
static hashval_t
htab_hash_plugin (const PTR p)
{
const struct plugin_name_args *plugin = (const struct plugin_name_args *) p;
return htab_hash_string (plugin->base_name);
}
/* Helper function for the hash table that compares the base_name of the
existing entry (S1) with the given string (S2). */
@ -183,10 +193,11 @@ add_new_plugin (const char* plugin_name)
/* If this is the first -fplugin= option we encounter, create
'plugin_name_args_tab' hash table. */
if (!plugin_name_args_tab)
plugin_name_args_tab = htab_create (10, htab_hash_string, htab_str_eq,
plugin_name_args_tab = htab_create (10, htab_hash_plugin, htab_str_eq,
NULL);
slot = htab_find_slot (plugin_name_args_tab, base_name, INSERT);
slot = htab_find_slot_with_hash (plugin_name_args_tab, base_name,
htab_hash_string (base_name), INSERT);
/* If the same plugin (name) has been specified earlier, either emit an
error or a warning message depending on if they have identical full
@ -273,7 +284,8 @@ parse_plugin_arg_opt (const char *arg)
/* Check if the named plugin has already been specified earlier in the
command-line. */
if (plugin_name_args_tab
&& ((slot = htab_find_slot (plugin_name_args_tab, name, NO_INSERT))
&& ((slot = htab_find_slot_with_hash (plugin_name_args_tab, name,
htab_hash_string (name), NO_INSERT))
!= NULL))
{
struct plugin_name_args *plugin = (struct plugin_name_args *) *slot;
@ -329,7 +341,8 @@ parse_plugin_arg_opt (const char *arg)
static void
register_plugin_info (const char* name, struct plugin_info *info)
{
void **slot = htab_find_slot (plugin_name_args_tab, name, NO_INSERT);
void **slot = htab_find_slot_with_hash (plugin_name_args_tab, name,
htab_hash_string (name), NO_INSERT);
struct plugin_name_args *plugin = (struct plugin_name_args *) *slot;
plugin->version = info->version;
plugin->help = info->help;
@ -627,7 +640,8 @@ init_one_plugin (void **slot, void * ARG_UNUSED (info))
bool ok = try_init_one_plugin (plugin);
if (!ok)
{
htab_remove_elt (plugin_name_args_tab, plugin->base_name);
htab_remove_elt_with_hash (plugin_name_args_tab, plugin->base_name,
htab_hash_string (plugin->base_name));
XDELETE (plugin);
}
return 1;

View File

@ -1,3 +1,26 @@
2017-05-10 Richard Biener <rguenther@suse.de>
Backport from mainline
2017-03-17 Richard Biener <rguenther@suse.de>
PR middle-end/80075
* g++.dg/torture/pr80075.C: New testcase.
2017-03-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/80122
* gcc.dg/torture/pr80122.c: New testcase.
2017-03-24 Richard Biener <rguenther@suse.de>
PR tree-optimization/80167
* gcc.dg/graphite/pr80167.c: New testcase.
2017-03-27 Richard Biener <rguenther@suse.de>
PR middle-end/80171
* g++.dg/torture/pr80171.C: New testcase.
2017-05-09 Richard Biener <rguenther@suse.de>
Backport from mainline

View File

@ -0,0 +1,27 @@
// { dg-do compile }
// { dg-additional-options "-fnon-call-exceptions" }
struct s {
int i;
};
extern int use_memcpy;
extern void my_memcpy(void*, void*, int);
int
f (struct s* p)
{
struct s a;
try
{
a = (struct s){};
if (!use_memcpy)
*p = a;
else
my_memcpy (p, &a, sizeof (struct s));
} catch (...) {
return 0;
}
return 1;
}

View File

@ -0,0 +1,183 @@
// { dg-do compile }
template <typename> struct remove_reference;
template <typename _Tp> struct remove_reference<_Tp &> { typedef _Tp type; };
template <typename _Tp> typename remove_reference<_Tp>::type move(_Tp &&p1) {
return static_cast<typename remove_reference<_Tp>::type &&>(p1);
}
void *operator new(__SIZE_TYPE__, void *p2) { return p2; }
struct Trans_NS__v1_GenericTlv {
virtual int getMinimumValueLength();
virtual unsigned long getValueLength() const;
};
struct IPv4NeighborAddressSubTlv;
struct Trans_NS__v1_GenericTlvBase : Trans_NS__v1_GenericTlv {
virtual bool operator==(const IPv4NeighborAddressSubTlv &) const;
};
struct Trans_NS__v1_GenericUnsupportedTlv;
template <typename> struct backup_holder {
Trans_NS__v1_GenericUnsupportedTlv *backup_;
Trans_NS__v1_GenericUnsupportedTlv &get() { return *backup_; }
};
template <typename> struct make_reference_content {
typedef IPv4NeighborAddressSubTlv type;
};
template <typename> struct unwrap_recursive {
typedef IPv4NeighborAddressSubTlv type;
};
template <typename> struct begin_impl;
template <typename Sequence> struct begin {
typedef typename Sequence::tag tag_;
typedef typename begin_impl<tag_>::template apply<Sequence>::type type;
};
struct long_ {
static const int value = 0;
};
template <typename> struct O1_size_impl;
template <typename Sequence>
struct O1_size
: O1_size_impl<typename Sequence::tag>::template apply<Sequence> {};
template <typename F, typename T2>
struct apply_wrap2 : F::template apply<int, T2> {};
template <int, typename, typename> struct iter_fold_impl;
template <typename First, typename ForwardOp>
struct iter_fold_impl<0, First, ForwardOp> {
typedef typename apply_wrap2<ForwardOp, First>::type state;
};
template <typename Sequence, typename ForwardOp> struct iter_fold {
typedef
typename iter_fold_impl<O1_size<Sequence>::value,
typename begin<Sequence>::type, ForwardOp>::state
type;
};
template <typename> struct deref;
template <typename T1> struct pair { typedef T1 first; };
struct make_initializer_node {
template <typename, typename Iterator> struct apply {
struct initializer_node {
typedef typename deref<Iterator>::type recursive_enabled_T;
static int
initialize(void *p1,
typename unwrap_recursive<recursive_enabled_T>::type) {
new (p1) typename make_reference_content<recursive_enabled_T>::type;
}
};
typedef pair<initializer_node> type;
};
};
struct l_item {
typedef int tag;
typedef l_item type;
typedef long_ size;
typedef int item;
};
template <> struct O1_size_impl<int> {
template <typename List> struct apply : List::size {};
};
template <typename> struct l_iter;
template <typename Node> struct deref<l_iter<Node>> {
typedef typename Node::item type;
};
template <> struct begin_impl<int> {
template <typename List> struct apply {
typedef l_iter<typename List::type> type;
};
};
template <typename, typename, typename, typename, typename, typename, typename>
struct list : l_item {};
template <typename... T> struct make_variant_list { typedef list<T...> type; };
template <typename T> T cast_storage(void *p1) { return *static_cast<T *>(p1); }
struct visitation_impl_step {
typedef Trans_NS__v1_GenericUnsupportedTlv type;
};
template <typename Visitor, typename VoidPtrCV, typename T>
void visitation_impl_invoke_impl(Visitor p1, VoidPtrCV p2, T *) {
backup_holder<Trans_NS__v1_GenericUnsupportedTlv> __trans_tmp_8 =
cast_storage<backup_holder<T>>(p2);
p1.internal_visit(__trans_tmp_8, 0);
}
template <typename Visitor, typename VoidPtrCV, typename T,
typename NoBackupFlag>
void visitation_impl_invoke(Visitor p1, VoidPtrCV p2, T p3, NoBackupFlag) {
visitation_impl_invoke_impl(p1, p2, p3);
}
template <typename Which, typename step0, typename Visitor, typename VoidPtrCV,
typename NoBackupFlag>
void visitation_impl(Visitor p1, VoidPtrCV p2, NoBackupFlag, Which, step0 *) {
visitation_impl_invoke(p1, p2, static_cast<typename step0::type *>(0), 0);
}
struct move_into {
move_into(void *);
template <typename T> void internal_visit(backup_holder<T> p1, int) {
T __trans_tmp_2 = p1.get();
new (0) T(__trans_tmp_2);
}
};
template <typename, typename... TN> struct variant {
struct initializer : iter_fold<typename make_variant_list<int, TN...>::type,
make_initializer_node>::type::first {};
template <typename T> void convert_construct(T p1, int) {
void *__trans_tmp_9 = this;
initializer::initialize(__trans_tmp_9, p1);
}
template <typename T> variant(T p1) { convert_construct(p1, 0); }
variant(variant &&p1) {
move_into visitor(0);
p1.internal_apply_visitor(visitor);
}
template <typename Visitor> void internal_apply_visitor(Visitor p1) {
void *__trans_tmp_10 = this;
visitation_impl(p1, __trans_tmp_10, 0, 0,
static_cast<visitation_impl_step *>(0));
}
};
template <class...> struct generic_element_tlvs;
template <typename TlvConfig, class UnsupportedTlvClass, class TlvF,
class... TlvR>
struct generic_element_tlvs<TlvConfig, UnsupportedTlvClass, TlvF, TlvR...> {
typedef variant<UnsupportedTlvClass, TlvF, TlvR...> variant_type;
};
template <typename, typename> struct Trans_NS__v1_GenericTlvContainer {
template <class TlvClass> void addTlv(const TlvClass &);
};
template <typename TlvConfig, typename ElementTlvs>
template <class TlvClass>
void Trans_NS__v1_GenericTlvContainer<TlvConfig, ElementTlvs>::addTlv(
const TlvClass &p1) {
typename ElementTlvs::variant_type wrap(p1);
move(wrap);
}
template <typename ElementTlvs>
struct Trans_NS__v1_GenericContainerEntryBase
: Trans_NS__v1_GenericTlvContainer<int, ElementTlvs> {};
template <class>
struct Trans_NS__v1_GenericFixedLengthTlvBase : Trans_NS__v1_GenericTlvBase {
unsigned long getValueLength() const;
};
struct Trans_NS__v1_GenericUnsupportedTlv : Trans_NS__v1_GenericTlv {
long getHeaderLengthconst;
};
using isis_tlv_config = int;
template <class... TlvClasses>
using isis_element_tlvs =
generic_element_tlvs<isis_tlv_config, Trans_NS__v1_GenericUnsupportedTlv,
TlvClasses...>;
template <int, class, typename ElementTlvs>
using ContainerEntryBase = Trans_NS__v1_GenericContainerEntryBase<ElementTlvs>;
template <int, class ImplClass, int>
using FixedLengthTlvBase = Trans_NS__v1_GenericFixedLengthTlvBase<ImplClass>;
struct IPv4NeighborAddressSubTlv
: FixedLengthTlvBase<0, IPv4NeighborAddressSubTlv, 0> {
bool operator==(const IPv4NeighborAddressSubTlv &) const;
};
void test() {
ContainerEntryBase<
0, int,
isis_element_tlvs<
FixedLengthTlvBase<0, int, 0>, FixedLengthTlvBase<0, int, 0>,
IPv4NeighborAddressSubTlv, FixedLengthTlvBase<0, int, 0>,
FixedLengthTlvBase<0, int, 0>, FixedLengthTlvBase<0, int, 0>>>
isEntry;
IPv4NeighborAddressSubTlv nbAddressSubTlv;
isEntry.addTlv(nbAddressSubTlv);
}

View File

@ -0,0 +1,24 @@
/* { dg-do compile } */
/* { dg-options "-O2 -floop-nest-optimize" } */
typedef struct
{
short a;
short b;
short c;
} d;
extern d e[];
int f[8];
void
g (d *i)
{
int h = 0;
for (; h < 28; h++)
e[h].a = e[h].b = i[h].a;
h = 0;
for (; h < 8; h++)
f[h] = i[h].b + i[h].c;
h = 0;
for (; h < 8; h++)
f[h] = i[h].b;
}

View File

@ -0,0 +1,52 @@
/* { dg-do run } */
#define __GNU_ALWAYS_INLINE inline __attribute__(( __always_inline__))
#define DEVT_ALL 0
#define CMD_ABI_DEVICES 100
static __GNU_ALWAYS_INLINE int
send_msg_to_gm_w_dev_t(int msg_type, unsigned int dev_msg_type,
int devt, ...)
{
char s[256];
int nArgs = __builtin_va_arg_pack_len();
if (nArgs != 2)
__builtin_abort ();
__builtin_sprintf (s, "%d", __builtin_va_arg_pack ());
if (__builtin_strcmp (s, "99") != 0)
__builtin_abort ();
/* do something with nArgs and ... */
return 0;
}
static __GNU_ALWAYS_INLINE int
send_msg_to_gm(int msg_type, unsigned int dev_msg_type,
...)
{
int nArgs = __builtin_va_arg_pack_len();
if (nArgs != 2)
__builtin_abort ();
return send_msg_to_gm_w_dev_t(msg_type, dev_msg_type,
DEVT_ALL, __builtin_va_arg_pack());
}
static __GNU_ALWAYS_INLINE int
send_enable(unsigned int dev_msg_type, ...)
{
int nArgs = __builtin_va_arg_pack_len();
if (nArgs != 2)
__builtin_abort ();
return send_msg_to_gm(CMD_ABI_DEVICES, dev_msg_type, __builtin_va_arg_pack());
}
int
main(void)
{
int mode = 99;
send_enable(1, mode, sizeof(mode));
return 0;
}

View File

@ -2726,9 +2726,9 @@ tree_could_trap_p (tree expr)
an assignment or a conditional) may throw. */
static bool
stmt_could_throw_1_p (gimple *stmt)
stmt_could_throw_1_p (gassign *stmt)
{
enum tree_code code = gimple_expr_code (stmt);
enum tree_code code = gimple_assign_rhs_code (stmt);
bool honor_nans = false;
bool honor_snans = false;
bool fp_operation = false;
@ -2742,11 +2742,8 @@ stmt_could_throw_1_p (gimple *stmt)
|| TREE_CODE_CLASS (code) == tcc_binary
|| code == FMA_EXPR)
{
if (is_gimple_assign (stmt)
&& TREE_CODE_CLASS (code) == tcc_comparison)
if (TREE_CODE_CLASS (code) == tcc_comparison)
t = TREE_TYPE (gimple_assign_rhs1 (stmt));
else if (gimple_code (stmt) == GIMPLE_COND)
t = TREE_TYPE (gimple_cond_lhs (stmt));
else
t = gimple_expr_type (stmt);
fp_operation = FLOAT_TYPE_P (t);
@ -2759,17 +2756,21 @@ stmt_could_throw_1_p (gimple *stmt)
honor_trapv = true;
}
/* First check the LHS. */
if (tree_could_trap_p (gimple_assign_lhs (stmt)))
return true;
/* Check if the main expression may trap. */
t = is_gimple_assign (stmt) ? gimple_assign_rhs2 (stmt) : NULL;
ret = operation_could_trap_helper_p (code, fp_operation, honor_trapv,
honor_nans, honor_snans, t,
honor_nans, honor_snans,
gimple_assign_rhs2 (stmt),
&handled);
if (handled)
return ret;
/* If the expression does not trap, see if any of the individual operands may
trap. */
for (i = 0; i < gimple_num_ops (stmt); i++)
for (i = 1; i < gimple_num_ops (stmt); i++)
if (tree_could_trap_p (gimple_op (stmt, i)))
return true;
@ -2795,11 +2796,22 @@ stmt_could_throw_p (gimple *stmt)
case GIMPLE_CALL:
return !gimple_call_nothrow_p (as_a <gcall *> (stmt));
case GIMPLE_ASSIGN:
case GIMPLE_COND:
if (!cfun->can_throw_non_call_exceptions)
{
if (!cfun->can_throw_non_call_exceptions)
return false;
gcond *cond = as_a <gcond *> (stmt);
tree lhs = gimple_cond_lhs (cond);
return operation_could_trap_p (gimple_cond_code (cond),
FLOAT_TYPE_P (TREE_TYPE (lhs)),
false, NULL_TREE);
}
case GIMPLE_ASSIGN:
if (!cfun->can_throw_non_call_exceptions
|| gimple_clobber_p (stmt))
return false;
return stmt_could_throw_1_p (stmt);
return stmt_could_throw_1_p (as_a <gassign *> (stmt));
case GIMPLE_ASM:
if (!cfun->can_throw_non_call_exceptions)

View File

@ -1843,7 +1843,8 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
call_stmt = dyn_cast <gcall *> (stmt);
if (call_stmt
&& gimple_call_va_arg_pack_p (call_stmt)
&& id->call_stmt)
&& id->call_stmt
&& ! gimple_call_va_arg_pack_p (id->call_stmt))
{
/* __builtin_va_arg_pack () should be replaced by
all arguments corresponding to ... in the caller. */
@ -1923,7 +1924,8 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
&& id->call_stmt
&& (decl = gimple_call_fndecl (stmt))
&& DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL
&& DECL_FUNCTION_CODE (decl) == BUILT_IN_VA_ARG_PACK_LEN)
&& DECL_FUNCTION_CODE (decl) == BUILT_IN_VA_ARG_PACK_LEN
&& ! gimple_call_va_arg_pack_p (id->call_stmt))
{
/* __builtin_va_arg_pack_len () should be replaced by
the number of anonymous arguments. */
@ -4536,7 +4538,7 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
id->src_fn = fn;
id->src_node = cg_edge->callee;
id->src_cfun = DECL_STRUCT_FUNCTION (fn);
id->call_stmt = stmt;
id->call_stmt = call_stmt;
/* If the src function contains an IFN_VA_ARG, then so will the dst
function after inlining. */

View File

@ -81,7 +81,7 @@ struct copy_body_data
/* GIMPLE_CALL if va arg parameter packs should be expanded or NULL
is not. */
gimple *call_stmt;
gcall *call_stmt;
/* Exception landing pad the inlined call lies in. */
int eh_lp_nr;

View File

@ -765,7 +765,7 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
base = ref;
while (handled_component_p (base))
base = TREE_OPERAND (base, 0);
unsigned int base_alignment;
unsigned int base_alignment = 0;
unsigned HOST_WIDE_INT base_bitpos;
get_object_alignment_1 (base, &base_alignment, &base_bitpos);
/* As data-ref analysis strips the MEM_REF down to its base operand
@ -774,8 +774,17 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
DR_BASE_ADDRESS. */
if (TREE_CODE (base) == MEM_REF)
{
base_bitpos -= mem_ref_offset (base).to_short_addr () * BITS_PER_UNIT;
base_bitpos &= (base_alignment - 1);
/* Note all this only works if DR_BASE_ADDRESS is the same as
MEM_REF operand zero, otherwise DR/SCEV analysis might have factored
in other offsets. We need to rework DR to compute the alingment
of DR_BASE_ADDRESS as long as all information is still available. */
if (operand_equal_p (TREE_OPERAND (base, 0), base_addr, 0))
{
base_bitpos -= mem_ref_offset (base).to_short_addr () * BITS_PER_UNIT;
base_bitpos &= (base_alignment - 1);
}
else
base_bitpos = BITS_PER_UNIT;
}
if (base_bitpos != 0)
base_alignment = base_bitpos & -base_bitpos;