Recognize the identity function for division. Suggested-by: Luis Pires <luis.pi...@eldorado.org.br> Signed-off-by: Richard Henderson <richard.hender...@linaro.org> --- tcg/optimize.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tcg/optimize.c b/tcg/optimize.c index fe2b1eb18e..92684d4b1d 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -1217,7 +1217,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) -- 2.25.1