Prevent potential NULL pointer dereference in expand_compare
[smatch.git] / simplify.c
blob3adcef11bdc50e0e5129f784df51ff2b9d415fe2
1 /*
2 * Simplify - do instruction simplification before CSE
4 * Copyright (C) 2004 Linus Torvalds
5 */
7 #include <assert.h>
9 #include "parse.h"
10 #include "expression.h"
11 #include "linearize.h"
12 #include "flow.h"
14 /* Find the trivial parent for a phi-source */
15 static struct basic_block *phi_parent(struct basic_block *source, pseudo_t pseudo)
17 /* Can't go upwards if the pseudo is defined in the bb it came from.. */
18 if (pseudo->type == PSEUDO_REG) {
19 struct instruction *def = pseudo->def;
20 if (def->bb == source)
21 return source;
23 if (bb_list_size(source->children) != 1 || bb_list_size(source->parents) != 1)
24 return source;
25 return first_basic_block(source->parents);
28 static void clear_phi(struct instruction *insn)
30 pseudo_t phi;
32 insn->bb = NULL;
33 FOR_EACH_PTR(insn->phi_list, phi) {
34 *THIS_ADDRESS(phi) = VOID;
35 } END_FOR_EACH_PTR(phi);
38 static int if_convert_phi(struct instruction *insn)
40 pseudo_t array[3];
41 struct basic_block *parents[3];
42 struct basic_block *bb, *bb1, *bb2, *source;
43 struct instruction *br;
44 pseudo_t p1, p2;
46 bb = insn->bb;
47 if (linearize_ptr_list((struct ptr_list *)insn->phi_list, (void **)array, 3) != 2)
48 return 0;
49 if (linearize_ptr_list((struct ptr_list *)bb->parents, (void **)parents, 3) != 2)
50 return 0;
51 p1 = array[0]->def->src1;
52 bb1 = array[0]->def->bb;
53 p2 = array[1]->def->src1;
54 bb2 = array[1]->def->bb;
56 /* Only try the simple "direct parents" case */
57 if ((bb1 != parents[0] || bb2 != parents[1]) &&
58 (bb1 != parents[1] || bb2 != parents[0]))
59 return 0;
62 * See if we can find a common source for this..
64 source = phi_parent(bb1, p1);
65 if (source != phi_parent(bb2, p2))
66 return 0;
69 * Cool. We now know that 'source' is the exclusive
70 * parent of both phi-nodes, so the exit at the
71 * end of it fully determines which one it is, and
72 * we can turn it into a select.
74 * HOWEVER, right now we only handle regular
75 * conditional branches. No multijumps or computed
76 * stuff. Verify that here.
78 br = last_instruction(source->insns);
79 if (!br || br->opcode != OP_BR)
80 return 0;
82 assert(br->cond);
83 assert(br->bb_false);
86 * We're in business. Match up true/false with p1/p2.
88 if (br->bb_true == bb2 || br->bb_false == bb1) {
89 pseudo_t p = p1;
90 p1 = p2;
91 p2 = p;
95 * OK, we can now replace that last
97 * br cond, a, b
99 * with the sequence
101 * setcc cond
102 * select pseudo, p1, p2
103 * br cond, a, b
105 * and remove the phi-node. If it then
106 * turns out that 'a' or 'b' is entirely
107 * empty (common case), and now no longer
108 * a phi-source, we'll be able to simplify
109 * the conditional branch too.
111 insert_select(source, br, insn, p1, p2);
112 clear_phi(insn);
113 return REPEAT_CSE;
116 static int clean_up_phi(struct instruction *insn)
118 pseudo_t phi;
119 struct instruction *last;
120 int same;
122 last = NULL;
123 same = 1;
124 FOR_EACH_PTR(insn->phi_list, phi) {
125 struct instruction *def;
126 if (phi == VOID)
127 continue;
128 def = phi->def;
129 if (def->src1 == VOID || !def->bb)
130 continue;
131 if (last) {
132 if (last->src1 != def->src1)
133 same = 0;
134 continue;
136 last = def;
137 } END_FOR_EACH_PTR(phi);
139 if (same) {
140 pseudo_t pseudo = last ? last->src1 : VOID;
141 convert_instruction_target(insn, pseudo);
142 clear_phi(insn);
143 return REPEAT_CSE;
146 return if_convert_phi(insn);
149 int delete_pseudo_user_list_entry(struct pseudo_user_list **list, pseudo_t *entry, int count)
151 struct pseudo_user *pu;
153 FOR_EACH_PTR(*list, pu) {
154 if (pu->userp == entry) {
155 DELETE_CURRENT_PTR(pu);
156 if (!--count)
157 goto out;
159 } END_FOR_EACH_PTR(pu);
160 assert(count <= 0);
161 out:
162 pack_ptr_list((struct ptr_list **)list);
163 return count;
166 static inline void remove_usage(pseudo_t p, pseudo_t *usep)
168 if (has_use_list(p)) {
169 delete_pseudo_user_list_entry(&p->users, usep, 1);
170 if (!p->users)
171 kill_instruction(p->def);
175 void kill_use(pseudo_t *usep)
177 if (usep) {
178 pseudo_t p = *usep;
179 *usep = VOID;
180 remove_usage(p, usep);
184 void kill_instruction(struct instruction *insn)
186 if (!insn || !insn->bb)
187 return;
189 switch (insn->opcode) {
190 case OP_BINARY ... OP_BINCMP_END:
191 insn->bb = NULL;
192 kill_use(&insn->src1);
193 kill_use(&insn->src2);
194 repeat_phase |= REPEAT_CSE;
195 return;
197 case OP_NOT: case OP_NEG:
198 insn->bb = NULL;
199 kill_use(&insn->src1);
200 repeat_phase |= REPEAT_CSE;
201 return;
203 case OP_PHI:
204 insn->bb = NULL;
205 repeat_phase |= REPEAT_CSE;
206 return;
208 case OP_SYMADDR:
209 insn->bb = NULL;
210 repeat_phase |= REPEAT_CSE | REPEAT_SYMBOL_CLEANUP;
211 return;
213 case OP_RANGE:
214 insn->bb = NULL;
215 repeat_phase |= REPEAT_CSE;
216 kill_use(&insn->src1);
217 kill_use(&insn->src2);
218 kill_use(&insn->src3);
219 return;
220 case OP_BR:
221 insn->bb = NULL;
222 repeat_phase |= REPEAT_CSE;
223 if (insn->cond)
224 kill_use(&insn->cond);
225 return;
230 * Kill trivially dead instructions
232 static int dead_insn(struct instruction *insn, pseudo_t *src1, pseudo_t *src2, pseudo_t *src3)
234 struct pseudo_user *pu;
235 FOR_EACH_PTR(insn->target->users, pu) {
236 if (*pu->userp != VOID)
237 return 0;
238 } END_FOR_EACH_PTR(pu);
240 insn->bb = NULL;
241 kill_use(src1);
242 kill_use(src2);
243 kill_use(src3);
244 return REPEAT_CSE;
247 static inline int constant(pseudo_t pseudo)
249 return pseudo->type == PSEUDO_VAL;
252 static int replace_with_pseudo(struct instruction *insn, pseudo_t pseudo)
254 convert_instruction_target(insn, pseudo);
255 insn->bb = NULL;
256 return REPEAT_CSE;
259 static int simplify_constant_rightside(struct instruction *insn)
261 long long value = insn->src2->value;
263 switch (insn->opcode) {
264 case OP_SUB:
265 if (value) {
266 insn->opcode = OP_ADD;
267 insn->src2 = value_pseudo(-value);
268 return REPEAT_CSE;
270 /* Fall through */
271 case OP_ADD:
272 case OP_OR: case OP_XOR:
273 case OP_OR_BOOL:
274 case OP_SHL:
275 case OP_LSR: case OP_ASR:
276 if (!value)
277 return replace_with_pseudo(insn, insn->src1);
278 return 0;
280 case OP_MULU: case OP_MULS:
281 case OP_AND_BOOL:
282 if (value == 1)
283 return replace_with_pseudo(insn, insn->src1);
284 /* Fall through */
285 case OP_AND:
286 if (!value)
287 return replace_with_pseudo(insn, insn->src2);
288 return 0;
290 return 0;
293 static int simplify_constant_leftside(struct instruction *insn)
295 long long value = insn->src1->value;
297 switch (insn->opcode) {
298 case OP_ADD: case OP_OR: case OP_XOR:
299 if (!value)
300 return replace_with_pseudo(insn, insn->src2);
301 return 0;
303 case OP_SHL:
304 case OP_LSR: case OP_ASR:
305 case OP_AND:
306 case OP_MULU: case OP_MULS:
307 if (!value)
308 return replace_with_pseudo(insn, insn->src1);
309 return 0;
311 return 0;
314 static int simplify_constant_binop(struct instruction *insn)
316 /* FIXME! Verify signs and sizes!! */
317 long long left = insn->src1->value;
318 long long right = insn->src2->value;
319 unsigned long long ul, ur;
320 long long res, mask, bits;
322 mask = 1ULL << (insn->size-1);
323 bits = mask | (mask-1);
325 if (left & mask)
326 left |= ~bits;
327 if (right & mask)
328 right |= ~bits;
329 ul = left & bits;
330 ur = right & bits;
332 switch (insn->opcode) {
333 case OP_ADD:
334 res = left + right;
335 break;
336 case OP_SUB:
337 res = left - right;
338 break;
339 case OP_MULU:
340 res = ul * ur;
341 break;
342 case OP_MULS:
343 res = left * right;
344 break;
345 case OP_DIVU:
346 if (!ur)
347 return 0;
348 res = ul / ur;
349 break;
350 case OP_DIVS:
351 if (!right)
352 return 0;
353 res = left / right;
354 break;
355 case OP_MODU:
356 if (!ur)
357 return 0;
358 res = ul % ur;
359 break;
360 case OP_MODS:
361 if (!right)
362 return 0;
363 res = left % right;
364 break;
365 case OP_SHL:
366 res = left << right;
367 break;
368 case OP_LSR:
369 res = ul >> ur;
370 break;
371 case OP_ASR:
372 res = left >> right;
373 break;
374 /* Logical */
375 case OP_AND:
376 res = left & right;
377 break;
378 case OP_OR:
379 res = left | right;
380 break;
381 case OP_XOR:
382 res = left ^ right;
383 break;
384 case OP_AND_BOOL:
385 res = left && right;
386 break;
387 case OP_OR_BOOL:
388 res = left || right;
389 break;
391 /* Binary comparison */
392 case OP_SET_EQ:
393 res = left == right;
394 break;
395 case OP_SET_NE:
396 res = left != right;
397 break;
398 case OP_SET_LE:
399 res = left <= right;
400 break;
401 case OP_SET_GE:
402 res = left >= right;
403 break;
404 case OP_SET_LT:
405 res = left < right;
406 break;
407 case OP_SET_GT:
408 res = left > right;
409 break;
410 case OP_SET_B:
411 res = ul < ur;
412 break;
413 case OP_SET_A:
414 res = ul > ur;
415 break;
416 case OP_SET_BE:
417 res = ul <= ur;
418 break;
419 case OP_SET_AE:
420 res = ul >= ur;
421 break;
422 default:
423 return 0;
425 res &= bits;
427 replace_with_pseudo(insn, value_pseudo(res));
428 return REPEAT_CSE;
431 static int simplify_binop(struct instruction *insn)
433 if (dead_insn(insn, &insn->src1, &insn->src2, NULL))
434 return REPEAT_CSE;
435 if (constant(insn->src1)) {
436 if (constant(insn->src2))
437 return simplify_constant_binop(insn);
438 return simplify_constant_leftside(insn);
440 if (constant(insn->src2))
441 return simplify_constant_rightside(insn);
442 return 0;
445 static void switch_pseudo(struct instruction *insn1, pseudo_t *pp1, struct instruction *insn2, pseudo_t *pp2)
447 pseudo_t p1 = *pp1, p2 = *pp2;
449 use_pseudo(insn1, p2, pp1);
450 use_pseudo(insn2, p1, pp2);
451 remove_usage(p1, pp1);
452 remove_usage(p2, pp2);
455 static int canonical_order(pseudo_t p1, pseudo_t p2)
457 /* symbol/constants on the right */
458 if (p1->type == PSEUDO_VAL)
459 return p2->type == PSEUDO_VAL;
461 if (p1->type == PSEUDO_SYM)
462 return p2->type == PSEUDO_SYM || p2->type == PSEUDO_VAL;
464 return 1;
467 static int simplify_commutative_binop(struct instruction *insn)
469 if (!canonical_order(insn->src1, insn->src2)) {
470 switch_pseudo(insn, &insn->src1, insn, &insn->src2);
471 return REPEAT_CSE;
473 return 0;
476 static inline int simple_pseudo(pseudo_t pseudo)
478 return pseudo->type == PSEUDO_VAL || pseudo->type == PSEUDO_SYM;
481 static int simplify_associative_binop(struct instruction *insn)
483 struct instruction *def;
484 pseudo_t pseudo = insn->src1;
486 if (!simple_pseudo(insn->src2))
487 return 0;
488 if (pseudo->type != PSEUDO_REG)
489 return 0;
490 def = pseudo->def;
491 if (def == insn)
492 return 0;
493 if (def->opcode != insn->opcode)
494 return 0;
495 if (!simple_pseudo(def->src2))
496 return 0;
497 if (ptr_list_size((struct ptr_list *)def->target->users) != 1)
498 return 0;
499 switch_pseudo(def, &def->src1, insn, &insn->src2);
500 return REPEAT_CSE;
503 static int simplify_constant_unop(struct instruction *insn)
505 long long val = insn->src1->value;
506 long long res, mask;
508 switch (insn->opcode) {
509 case OP_NOT:
510 res = ~val;
511 break;
512 case OP_NEG:
513 res = -val;
514 break;
515 default:
516 return 0;
518 mask = 1ULL << (insn->size-1);
519 res &= mask | (mask-1);
521 replace_with_pseudo(insn, value_pseudo(res));
522 return REPEAT_CSE;
525 static int simplify_unop(struct instruction *insn)
527 if (dead_insn(insn, &insn->src1, NULL, NULL))
528 return REPEAT_CSE;
529 if (constant(insn->src1))
530 return simplify_constant_unop(insn);
531 return 0;
534 static int simplify_one_memop(struct instruction *insn, pseudo_t orig)
536 pseudo_t addr = insn->src;
537 pseudo_t new, off;
539 if (addr->type == PSEUDO_REG) {
540 struct instruction *def = addr->def;
541 if (def->opcode == OP_SYMADDR && def->src) {
542 kill_use(&insn->src);
543 use_pseudo(insn, def->src, &insn->src);
544 return REPEAT_CSE | REPEAT_SYMBOL_CLEANUP;
546 if (def->opcode == OP_ADD) {
547 new = def->src1;
548 off = def->src2;
549 if (constant(off))
550 goto offset;
551 new = off;
552 off = def->src1;
553 if (constant(off))
554 goto offset;
555 return 0;
558 return 0;
560 offset:
561 /* Invalid code */
562 if (new == orig) {
563 if (new == VOID)
564 return 0;
565 new = VOID;
566 warning(insn->pos, "crazy programmer");
568 insn->offset += off->value;
569 use_pseudo(insn, new, &insn->src);
570 remove_usage(addr, &insn->src);
571 return REPEAT_CSE | REPEAT_SYMBOL_CLEANUP;
575 * We walk the whole chain of adds/subs backwards. That's not
576 * only more efficient, but it allows us to find loops.
578 static int simplify_memop(struct instruction *insn)
580 int one, ret = 0;
581 pseudo_t orig = insn->src;
583 do {
584 one = simplify_one_memop(insn, orig);
585 ret |= one;
586 } while (one);
587 return ret;
590 static long long get_cast_value(long long val, int old_size, int new_size, int sign)
592 long long mask;
594 if (sign && new_size > old_size) {
595 mask = 1 << (old_size-1);
596 if (val & mask)
597 val |= ~(mask | (mask-1));
599 mask = 1 << (new_size-1);
600 return val & (mask | (mask-1));
603 static int simplify_cast(struct instruction *insn)
605 struct symbol *orig_type;
606 int orig_size, size;
607 pseudo_t src;
609 if (dead_insn(insn, &insn->src, NULL, NULL))
610 return REPEAT_CSE;
612 orig_type = insn->orig_type;
613 if (!orig_type)
614 return 0;
615 orig_size = orig_type->bit_size;
616 size = insn->size;
617 src = insn->src;
619 /* A cast of a constant? */
620 if (constant(src)) {
621 int sign = orig_type->ctype.modifiers & MOD_SIGNED;
622 long long val = get_cast_value(src->value, orig_size, size, sign);
623 src = value_pseudo(val);
624 goto simplify;
627 /* A cast of a "and" might be a no-op.. */
628 if (src->type == PSEUDO_REG) {
629 struct instruction *def = src->def;
630 if (def->opcode == OP_AND && def->size >= size) {
631 pseudo_t val = def->src2;
632 if (val->type == PSEUDO_VAL) {
633 unsigned long long value = val->value;
634 if (!(value >> (size-1)))
635 goto simplify;
640 if (size == orig_size) {
641 int op = (orig_type->ctype.modifiers & MOD_SIGNED) ? OP_SCAST : OP_CAST;
642 if (insn->opcode == op)
643 goto simplify;
646 return 0;
648 simplify:
649 return replace_with_pseudo(insn, src);
652 static int simplify_select(struct instruction *insn)
654 pseudo_t cond, src1, src2;
656 if (dead_insn(insn, &insn->src1, &insn->src2, &insn->src3))
657 return REPEAT_CSE;
659 cond = insn->src1;
660 src1 = insn->src2;
661 src2 = insn->src3;
662 if (constant(cond) || src1 == src2) {
663 pseudo_t *kill, take;
664 kill_use(&insn->src1);
665 take = cond->value ? src1 : src2;
666 kill = cond->value ? &insn->src3 : &insn->src2;
667 kill_use(kill);
668 replace_with_pseudo(insn, take);
669 return REPEAT_CSE;
671 if (constant(src1) && constant(src2)) {
672 long long val1 = src1->value;
673 long long val2 = src2->value;
675 /* The pair 0/1 is special - replace with SETNE/SETEQ */
676 if ((val1 | val2) == 1) {
677 int opcode = OP_SET_EQ;
678 if (val1) {
679 src1 = src2;
680 opcode = OP_SET_NE;
682 insn->opcode = opcode;
683 /* insn->src1 is already cond */
684 insn->src2 = src1; /* Zero */
685 return REPEAT_CSE;
688 return 0;
691 static int is_in_range(pseudo_t src, long long low, long long high)
693 long long value;
695 switch (src->type) {
696 case PSEUDO_VAL:
697 value = src->value;
698 return value >= low && value <= high;
699 default:
700 return 0;
704 static int simplify_range(struct instruction *insn)
706 pseudo_t src1, src2, src3;
708 src1 = insn->src1;
709 src2 = insn->src2;
710 src3 = insn->src3;
711 if (src2->type != PSEUDO_VAL || src3->type != PSEUDO_VAL)
712 return 0;
713 if (is_in_range(src1, src2->value, src3->value)) {
714 kill_instruction(insn);
715 return REPEAT_CSE;
717 return 0;
721 * Simplify "set_ne/eq $0 + br"
723 static int simplify_cond_branch(struct instruction *br, pseudo_t cond, struct instruction *def, pseudo_t *pp)
725 use_pseudo(br, *pp, &br->cond);
726 remove_usage(cond, &br->cond);
727 if (def->opcode == OP_SET_EQ) {
728 struct basic_block *true = br->bb_true;
729 struct basic_block *false = br->bb_false;
730 br->bb_false = true;
731 br->bb_true = false;
733 return REPEAT_CSE;
736 static int simplify_branch(struct instruction *insn)
738 pseudo_t cond = insn->cond;
740 if (!cond)
741 return 0;
743 /* Constant conditional */
744 if (constant(cond)) {
745 insert_branch(insn->bb, insn, cond->value ? insn->bb_true : insn->bb_false);
746 return REPEAT_CSE;
749 /* Same target? */
750 if (insn->bb_true == insn->bb_false) {
751 struct basic_block *bb = insn->bb;
752 struct basic_block *target = insn->bb_false;
753 remove_bb_from_list(&target->parents, bb, 1);
754 remove_bb_from_list(&bb->children, target, 1);
755 insn->bb_false = NULL;
756 kill_use(&insn->cond);
757 insn->cond = NULL;
758 return REPEAT_CSE;
761 /* Conditional on a SETNE $0 or SETEQ $0 */
762 if (cond->type == PSEUDO_REG) {
763 struct instruction *def = cond->def;
765 if (def->opcode == OP_SET_NE || def->opcode == OP_SET_EQ) {
766 if (constant(def->src1) && !def->src1->value)
767 return simplify_cond_branch(insn, cond, def, &def->src2);
768 if (constant(def->src2) && !def->src2->value)
769 return simplify_cond_branch(insn, cond, def, &def->src1);
771 if (def->opcode == OP_SEL) {
772 if (constant(def->src2) && constant(def->src3)) {
773 long long val1 = def->src2->value;
774 long long val2 = def->src3->value;
775 if (!val1 && !val2) {
776 insert_branch(insn->bb, insn, insn->bb_false);
777 return REPEAT_CSE;
779 if (val1 && val2) {
780 insert_branch(insn->bb, insn, insn->bb_true);
781 return REPEAT_CSE;
783 if (val2) {
784 struct basic_block *true = insn->bb_true;
785 struct basic_block *false = insn->bb_false;
786 insn->bb_false = true;
787 insn->bb_true = false;
789 use_pseudo(insn, def->src1, &insn->cond);
790 remove_usage(cond, &insn->cond);
791 return REPEAT_CSE;
794 if (def->opcode == OP_CAST || def->opcode == OP_SCAST) {
795 int orig_size = def->orig_type ? def->orig_type->bit_size : 0;
796 if (def->size > orig_size) {
797 use_pseudo(insn, def->src, &insn->cond);
798 remove_usage(cond, &insn->cond);
799 return REPEAT_CSE;
803 return 0;
806 static int simplify_switch(struct instruction *insn)
808 pseudo_t cond = insn->cond;
809 long long val;
810 struct multijmp *jmp;
812 if (!constant(cond))
813 return 0;
814 val = insn->cond->value;
816 FOR_EACH_PTR(insn->multijmp_list, jmp) {
817 /* Default case */
818 if (jmp->begin > jmp->end)
819 goto found;
820 if (val >= jmp->begin && val <= jmp->end)
821 goto found;
822 } END_FOR_EACH_PTR(jmp);
823 warning(insn->pos, "Impossible case statement");
824 return 0;
826 found:
827 insert_branch(insn->bb, insn, jmp->target);
828 return REPEAT_CSE;
831 int simplify_instruction(struct instruction *insn)
833 if (!insn->bb)
834 return 0;
835 switch (insn->opcode) {
836 case OP_ADD: case OP_MULS:
837 case OP_AND: case OP_OR: case OP_XOR:
838 case OP_AND_BOOL: case OP_OR_BOOL:
839 if (simplify_binop(insn))
840 return REPEAT_CSE;
841 if (simplify_commutative_binop(insn))
842 return REPEAT_CSE;
843 return simplify_associative_binop(insn);
845 case OP_MULU:
846 case OP_SET_EQ: case OP_SET_NE:
847 if (simplify_binop(insn))
848 return REPEAT_CSE;
849 return simplify_commutative_binop(insn);
851 case OP_SUB:
852 case OP_DIVU: case OP_DIVS:
853 case OP_MODU: case OP_MODS:
854 case OP_SHL:
855 case OP_LSR: case OP_ASR:
856 case OP_SET_LE: case OP_SET_GE:
857 case OP_SET_LT: case OP_SET_GT:
858 case OP_SET_B: case OP_SET_A:
859 case OP_SET_BE: case OP_SET_AE:
860 return simplify_binop(insn);
862 case OP_NOT: case OP_NEG:
863 return simplify_unop(insn);
864 case OP_LOAD: case OP_STORE:
865 return simplify_memop(insn);
866 case OP_SYMADDR:
867 if (dead_insn(insn, NULL, NULL, NULL))
868 return REPEAT_CSE | REPEAT_SYMBOL_CLEANUP;
869 return replace_with_pseudo(insn, insn->symbol);
870 case OP_CAST:
871 case OP_SCAST:
872 case OP_FPCAST:
873 case OP_PTRCAST:
874 return simplify_cast(insn);
875 case OP_PHI:
876 if (dead_insn(insn, NULL, NULL, NULL)) {
877 clear_phi(insn);
878 return REPEAT_CSE;
880 return clean_up_phi(insn);
881 case OP_PHISOURCE:
882 if (dead_insn(insn, &insn->phi_src, NULL, NULL))
883 return REPEAT_CSE;
884 break;
885 case OP_SEL:
886 return simplify_select(insn);
887 case OP_BR:
888 return simplify_branch(insn);
889 case OP_SWITCH:
890 return simplify_switch(insn);
891 case OP_RANGE:
892 return simplify_range(insn);
894 return 0;