diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2021-10-25 11:30:14 -0700 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2021-10-28 20:55:07 -0700 |
commit | 2f9d9a34221feb80d5b1fc6b584f910f8cee317a (patch) | |
tree | 47f089fab82c4f4f01ca0cca19193f5a513d54c5 /tcg | |
parent | 5b5cf47983c37d4c49eb2b8449bc62a7d3d76dbc (diff) |
tcg/optimize: Use fold_xi_to_x for div
Recognize the identity function for division.
Suggested-by: Luis Pires <luis.pires@eldorado.org.br>
Reviewed-by: Luis Pires <luis.pires@eldorado.org.br>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tcg')
-rw-r--r-- | tcg/optimize.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c index 907049fb06..f8b0709157 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1218,7 +1218,11 @@ static bool fold_deposit(OptContext *ctx, TCGOp *op) static bool fold_divide(OptContext *ctx, TCGOp *op) { - return fold_const2(ctx, op); + if (fold_const2(ctx, op) || + fold_xi_to_x(ctx, op, 1)) { + return true; + } + return false; } static bool fold_dup(OptContext *ctx, TCGOp *op) |