unsigned char pcr_select[4];
} sel;
+unsigned char buf[64];
int bar(void)
{
- static unsigned char buf[64];
-
sel.size_of_select = 3;
foo(buf, sel.pcr_select, sel.size_of_select);
int baz(void)
{
- static unsigned char buf[64];
-
sel.size_of_select = 5;
foo2(buf, sel.pcr_select, sel.size_of_select);
#include "value-prof.h"
#include "tree-inline.h"
#include "tree-ssa-live.h"
+#include "tree-ssa-dce.h"
#include "omp-general.h"
#include "omp-expand.h"
#include "tree-cfgcleanup.h"
/* Maybe Remove stores to variables we marked write-only.
Return true if a store was removed. */
static bool
-maybe_remove_writeonly_store (gimple_stmt_iterator &gsi, gimple *stmt)
+maybe_remove_writeonly_store (gimple_stmt_iterator &gsi, gimple *stmt,
+ bitmap dce_ssa_names)
{
/* Keep access when store has side effect, i.e. in case when source
is volatile. */
print_gimple_stmt (dump_file, stmt, 0,
TDF_VOPS|TDF_MEMSYMS);
}
+
+ /* Mark ssa name defining to be checked for simple dce. */
+ if (gimple_assign_single_p (stmt))
+ {
+ tree rhs = gimple_assign_rhs1 (stmt);
+ if (TREE_CODE (rhs) == SSA_NAME
+ && !SSA_NAME_IS_DEFAULT_DEF (rhs))
+ bitmap_set_bit (dce_ssa_names, SSA_NAME_VERSION (rhs));
+ }
unlink_stmt_vdef (stmt);
gsi_remove (&gsi, true);
release_defs (stmt);
profile_count num = node->count;
profile_count den = ENTRY_BLOCK_PTR_FOR_FN (cfun)->count;
bool scale = num.initialized_p () && !(num == den);
+ auto_bitmap dce_ssa_names;
if (scale)
{
}
/* Remove stores to variables we marked write-only. */
- if (maybe_remove_writeonly_store (gsi, stmt))
+ if (maybe_remove_writeonly_store (gsi, stmt, dce_ssa_names))
{
todo |= TODO_update_ssa | TODO_cleanup_cfg;
continue;
&& (todo & TODO_cleanup_cfg))
loops_state_set (LOOPS_NEED_FIXUP);
+ simple_dce_from_worklist (dce_ssa_names);
+
return todo;
}