+ * Check the users of an induction variable for register pressure.
+ */
+static int check_users_for_reg_pressure(ir_node *iv, iv_env *env) {
+ ir_node *irn, *header;
+ ir_node *have_user = NULL;
+ ir_node *have_cmp = NULL;
+ node_entry *e = get_irn_ne(iv, env);
+ scc *pscc = e->pscc;
+
+ header = e->header;
+ for (irn = pscc->head; irn != NULL; irn = e->next) {
+ const ir_edge_t *edge;
+
+ foreach_out_edge(irn, edge) {
+ ir_node *user = get_edge_src_irn(edge);
+ node_entry *ne = get_irn_ne(user, env);
+
+ if (e->header == ne->header) {
+ /* found user from the same IV */
+ continue;
+ }
+ if (is_Cmp(user)) {
+ if (have_cmp != NULL) {
+ /* more than one cmp, for now end here */
+ return 0;
+ }
+ have_cmp = user;
+ } else {
+ /* user is a real user of the IV */
+ if (have_user != NULL) {
+ /* found the second user */
+ return 0;
+ }
+ have_user = user;
+ }
+ }
+ e = get_irn_ne(irn, env);
+ }
+
+ if (have_user == NULL) {
+ /* no user, ignore */
+ return 1;
+ }
+
+ if (have_cmp == NULL) {
+ /* fine, only one user, try to reduce */
+ return 1;
+ }
+ /*
+ * We found one user AND at least one cmp.
+ * We should check here if we can transform the Cmp.
+ *
+ * For now our capabilities for doing linear function test
+ * are limited, so check if the iv has the right form: Only ONE
+ * phi, only one Add/Sub with a Const
+ */
+ if (! is_counter_iv(iv, env))
+ return 0;
+
+ /*
+ * Ok, we have only one increment AND it is a Const, we might be able
+ * to do a linear function test replacement, so go on.
+ */
+ return 1;
+}
+
+/**
+ * Check if a node can be replaced (+, -, *).
+ *
+ * @param irn the node to check
+ * @param env the environment
+ *
+ * @return non-zero if irn should be Replace'd