diff options
| -rw-r--r-- | sparse-llvm.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/sparse-llvm.c b/sparse-llvm.c index 9078488a..9f39c6e8 100644 --- a/sparse-llvm.c +++ b/sparse-llvm.c @@ -750,10 +750,8 @@ static void output_op_switch(struct function *fn, struct instruction *insn) int n_jmp = 0; FOR_EACH_PTR(insn->multijmp_list, jmp) { - if (jmp->begin == jmp->end) { /* case N */ - n_jmp++; - } else if (jmp->begin < jmp->end) { /* case M..N */ - assert(0); + if (jmp->begin <= jmp->end) { + n_jmp += (jmp->end - jmp->begin) + 1; } else /* default case */ def = jmp->target; } END_FOR_EACH_PTR(jmp); @@ -763,12 +761,11 @@ static void output_op_switch(struct function *fn, struct instruction *insn) def ? def->priv : NULL, n_jmp); FOR_EACH_PTR(insn->multijmp_list, jmp) { - if (jmp->begin == jmp->end) { /* case N */ - LLVMAddCase(target, - val_to_value(jmp->begin, insn->type), - jmp->target->priv); - } else if (jmp->begin < jmp->end) { /* case M..N */ - assert(0); + long val; + + for (val = jmp->begin; val <= jmp->end; val++) { + LLVMValueRef Val = val_to_value(val, insn->type); + LLVMAddCase(target, Val, jmp->target->priv); } } END_FOR_EACH_PTR(jmp); |
