From: Wolfgang Bumiller Date: Wed, 6 Nov 2013 15:57:04 +0000 (+0100) Subject: fix 0-x being turned into x X-Git-Tag: xonotic-v0.8.0~100 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=de14d514f306f4c7862151d45108a27b2f61abd2;p=xonotic%2Fgmqcc.git fix 0-x being turned into x --- diff --git a/fold.c b/fold.c index c9f1a06..0128dec 100644 --- a/fold.c +++ b/fold.c @@ -799,8 +799,10 @@ static ast_expression *fold_superfluous(ast_expression *left, ast_expression *ri break; - case INSTR_ADD_F: case INSTR_SUB_F: + if (swapped) + return NULL; + case INSTR_ADD_F: if (fold_immvalue_float(load) == 0.0f) { ++opts_optimizationcount[OPTIM_PEEPHOLE]; ast_unref(right); @@ -816,8 +818,10 @@ static ast_expression *fold_superfluous(ast_expression *left, ast_expression *ri } break; - case INSTR_ADD_V: case INSTR_SUB_V: + if (swapped) + return NULL; + case INSTR_ADD_V: if (vec3_cmp(fold_immvalue_vector(load), vec3_create(0, 0, 0))) { ++opts_optimizationcount[OPTIM_PEEPHOLE]; ast_unref(right);