@@ -760,10 +760,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);
@@ -773,12 +771,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);
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- sparse-llvm.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)