NEXT_PASS (pass_early_vrp);
NEXT_PASS (pass_merge_phi);
NEXT_PASS (pass_dse);
- NEXT_PASS (pass_cd_dce);
+ NEXT_PASS (pass_cd_dce, false /* update_address_taken_p */);
NEXT_PASS (pass_phiopt, true /* early_p */);
NEXT_PASS (pass_modref);
NEXT_PASS (pass_tail_recursion);
NEXT_PASS (pass_loop_jam);
/* All unswitching, final value replacement and splitting can expose
empty loops. Remove them now. */
- NEXT_PASS (pass_cd_dce);
+ NEXT_PASS (pass_cd_dce, false /* update_address_taken_p */);
NEXT_PASS (pass_iv_canon);
NEXT_PASS (pass_loop_distribution);
NEXT_PASS (pass_linterchange);
NEXT_PASS (pass_copy_prop);
NEXT_PASS (pass_warn_restrict);
NEXT_PASS (pass_dse);
- NEXT_PASS (pass_cd_dce);
+ NEXT_PASS (pass_cd_dce, true /* update_address_taken_p */);
+ /* After late CD DCE we rewrite no longer addressed locals into SSA
+ form if possible. */
NEXT_PASS (pass_forwprop);
NEXT_PASS (pass_phiopt, false /* early_p */);
NEXT_PASS (pass_fold_builtins);
--- /dev/null
+/* PR tree-optimization/96271 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mtune=intel -msse2 -masm=att" } */
+/* { dg-final { scan-assembler "movq\t%xmm0, %r" { target { ! ia32 } } } } */
+/* { dg-final { scan-assembler "movq\t%xmm1, %r" { target { ! ia32 } } } } */
+
+int
+foo (double a, double b)
+{
+ return __builtin_memcmp (&a, &b, sizeof (double)) == 0;
+}
{
public:
pass_cd_dce (gcc::context *ctxt)
- : gimple_opt_pass (pass_data_cd_dce, ctxt)
+ : gimple_opt_pass (pass_data_cd_dce, ctxt), update_address_taken_p (false)
{}
/* opt_pass methods: */
opt_pass * clone () { return new pass_cd_dce (m_ctxt); }
+ void set_pass_param (unsigned n, bool param)
+ {
+ gcc_assert (n == 0);
+ update_address_taken_p = param;
+ }
virtual bool gate (function *) { return flag_tree_dce != 0; }
- virtual unsigned int execute (function *) { return tree_ssa_cd_dce (); }
+ virtual unsigned int execute (function *)
+ {
+ return (tree_ssa_cd_dce ()
+ | (update_address_taken_p ? TODO_update_address_taken : 0));
+ }
+private:
+ bool update_address_taken_p;
}; // class pass_cd_dce
} // anon namespace