mirror of
https://github.com/danog/ir.git
synced 2025-01-22 05:31:32 +01:00
Eliminte useless checks
This commit is contained in:
parent
6f8012756e
commit
7fd1ccf48b
16
ir_gcm.c
16
ir_gcm.c
@ -144,12 +144,12 @@ int ir_gcm(ir_ctx *ctx)
|
||||
#if 1
|
||||
n = IR_INPUT_EDGES_COUNT(flags);
|
||||
if (!IR_IS_FIXED_INPUTS_COUNT(n) || n > 1) {
|
||||
ir_list_push(&queue_early, ref);
|
||||
ir_list_push_unchecked(&queue_early, ref);
|
||||
}
|
||||
#else
|
||||
if (IR_OPND_KIND(flags, 2) == IR_OPND_DATA
|
||||
|| IR_OPND_KIND(flags, 3) == IR_OPND_DATA) {
|
||||
ir_list_push(&queue_early, ref);
|
||||
ir_list_push_unchecked(&queue_early, ref);
|
||||
}
|
||||
#endif
|
||||
ref = insn->op1; /* control predecessor */
|
||||
@ -175,7 +175,7 @@ int ir_gcm(ir_ctx *ctx)
|
||||
ref = *p;
|
||||
if (ref > 0 && _blocks[ref] == 0) {
|
||||
_blocks[ref] = 1;
|
||||
ir_list_push(&queue_early, ref);
|
||||
ir_list_push_unchecked(&queue_early, ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -203,17 +203,17 @@ int ir_gcm(ir_ctx *ctx)
|
||||
#if 1
|
||||
n = IR_INPUT_EDGES_COUNT(flags);
|
||||
if (!IR_IS_FIXED_INPUTS_COUNT(n) || n > 1) {
|
||||
ir_list_push(&queue_early, ref);
|
||||
ir_list_push_unchecked(&queue_early, ref);
|
||||
}
|
||||
#else
|
||||
if (IR_OPND_KIND(flags, 2) == IR_OPND_DATA
|
||||
|| IR_OPND_KIND(flags, 3) == IR_OPND_DATA) {
|
||||
ir_list_push(&queue_early, ref);
|
||||
ir_list_push_unchecked(&queue_early, ref);
|
||||
}
|
||||
#endif
|
||||
if (insn->type != IR_VOID) {
|
||||
IR_ASSERT(flags & IR_OP_FLAG_MEM);
|
||||
ir_list_push(&queue_late, ref);
|
||||
ir_list_push_unchecked(&queue_late, ref);
|
||||
}
|
||||
ref = insn->op1; /* control predecessor */
|
||||
} while (ref != bb->start);
|
||||
@ -232,8 +232,8 @@ int ir_gcm(ir_ctx *ctx)
|
||||
ir_bitset_incl(visited, ref);
|
||||
if (EXPECTED(ctx->use_lists[ref].count != 0)) {
|
||||
_blocks[ref] = b; /* pin to block */
|
||||
ir_list_push(&queue_early, ref);
|
||||
ir_list_push(&queue_late, ref);
|
||||
ir_list_push_unchecked(&queue_early, ref);
|
||||
ir_list_push_unchecked(&queue_late, ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
14
ir_private.h
14
ir_private.h
@ -518,6 +518,12 @@ IR_ALWAYS_INLINE void ir_array_set(ir_array *a, uint32_t i, ir_ref val)
|
||||
a->refs[i] = val;
|
||||
}
|
||||
|
||||
IR_ALWAYS_INLINE void ir_array_set_unchecked(ir_array *a, uint32_t i, ir_ref val)
|
||||
{
|
||||
IR_ASSERT(i < a->size);
|
||||
a->refs[i] = val;
|
||||
}
|
||||
|
||||
/* List/Stack of numeric references */
|
||||
typedef struct _ir_list {
|
||||
ir_array a;
|
||||
@ -560,6 +566,11 @@ IR_ALWAYS_INLINE void ir_list_push(ir_list *l, ir_ref val)
|
||||
ir_array_set(&l->a, l->len++, val);
|
||||
}
|
||||
|
||||
IR_ALWAYS_INLINE void ir_list_push_unchecked(ir_list *l, ir_ref val)
|
||||
{
|
||||
ir_array_set_unchecked(&l->a, l->len++, val);
|
||||
}
|
||||
|
||||
IR_ALWAYS_INLINE ir_ref ir_list_pop(ir_list *l)
|
||||
{
|
||||
IR_ASSERT(l->len > 0);
|
||||
@ -619,7 +630,8 @@ IR_ALWAYS_INLINE bool ir_worklist_push(ir_worklist *w, ir_ref val)
|
||||
return 0;
|
||||
}
|
||||
ir_bitset_incl(w->visited, val);
|
||||
ir_list_push(&w->l, val);
|
||||
IR_ASSERT(ir_list_len(&w->l) < ir_list_capasity(&w->l));
|
||||
ir_list_push_unchecked(&w->l, val);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user