imm_use_iterator imm_iter;
gimple *stmt;
auto_vec <tree, 4> worklist;
+ auto_vec <gimple *, 4> kill_list;
worklist.safe_push (name);
while (!worklist.is_empty ())
if (!killed_ssas->add (lhs))
{
worklist.safe_push (lhs);
- gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
- gsi_remove (&gsi, true);
+ kill_list.safe_push (stmt);
}
}
}
+
+ /* Remove stmts in reverse and afterwards to properly handle debug stmt
+ generation and to not interfere with immediate use iteration. */
+ while (!kill_list.is_empty ())
+ {
+ stmt = kill_list.pop ();
+ gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
+ gsi_remove (&gsi, true);
+ }
}
/* Modify actual arguments of a function call in statement currently belonging
--- /dev/null
+// { dg-do compile }
+// { dg-additional-options "-g" }
+
+int a, b, c;
+char bk(int, int);
+void bl(int);
+inline unsigned d() {
+ bl(c);
+ return bk(b, 0);
+}
+struct e {
+ template <class bc> e(bc &);
+};
+int g(e) { return 0; }
+unsigned h(e k) { return g(k); }
+unsigned i(e k) { return h(k); }
+inline unsigned j() {
+ unsigned bh = i(a);
+ bh += d();
+ return bh;
+}
+void f() {
+ j();
+ j();
+ __builtin_unreachable();
+}