瀏覽代碼

tcg/optimize: Use finish_folding in fold_sub, fold_sub_vec

Duplicate fold_sub_vec into fold_sub instead of calling it,
now that fold_sub_vec always returns true.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Richard Henderson 8 月之前
父節點
當前提交
fe1d0074b5
共有 1 個文件被更改,包括 6 次插入3 次删除
  1. 6 3
      tcg/optimize.c

+ 6 - 3
tcg/optimize.c

@@ -2620,12 +2620,15 @@ static bool fold_sub_vec(OptContext *ctx, TCGOp *op)
         fold_sub_to_neg(ctx, op)) {
         fold_sub_to_neg(ctx, op)) {
         return true;
         return true;
     }
     }
-    return false;
+    return finish_folding(ctx, op);
 }
 }
 
 
 static bool fold_sub(OptContext *ctx, TCGOp *op)
 static bool fold_sub(OptContext *ctx, TCGOp *op)
 {
 {
-    if (fold_const2(ctx, op) || fold_sub_vec(ctx, op)) {
+    if (fold_const2(ctx, op) ||
+        fold_xx_to_i(ctx, op, 0) ||
+        fold_xi_to_x(ctx, op, 0) ||
+        fold_sub_to_neg(ctx, op)) {
         return true;
         return true;
     }
     }
 
 
@@ -2637,7 +2640,7 @@ static bool fold_sub(OptContext *ctx, TCGOp *op)
                    ? INDEX_op_add_i32 : INDEX_op_add_i64);
                    ? INDEX_op_add_i32 : INDEX_op_add_i64);
         op->args[2] = arg_new_constant(ctx, -val);
         op->args[2] = arg_new_constant(ctx, -val);
     }
     }
-    return false;
+    return finish_folding(ctx, op);
 }
 }
 
 
 static bool fold_sub2(OptContext *ctx, TCGOp *op)
 static bool fold_sub2(OptContext *ctx, TCGOp *op)