- /* Matze: it would be better to force mode to mode_uint as this creates more
- * opportunities for CSE. Unforunately we still have some optimisations that
- * are too conservative in the presence of convs. So we better go with the
- * mode of offset and avoid the conv */
- ir_mode *mode = get_irn_mode(offset);
- offset = create_conv(dbgi, offset, mode);
+ type_t *offset_type = skip_typeref(expression->index->base.type);
+ ir_mode *mode;
+ if (is_type_signed(offset_type)) {
+ mode = get_ir_mode(type_ssize_t);
+ } else {
+ mode = get_ir_mode(type_size_t);
+ }
+ offset = create_conv(dbgi, offset, mode);