From e107793b68762d6ffed2c46ec931c7ef37479dcc Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 30 Mar 2018 21:00:37 -0700 Subject: [PATCH] Pre-opt: Use the correct operand in the irsub_imm pattern. --- cranelift/filetests/preopt/simplify.cton | 2 +- lib/cretonne/src/preopt.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cranelift/filetests/preopt/simplify.cton b/cranelift/filetests/preopt/simplify.cton index a2e67caf31..020e2f0108 100644 --- a/cranelift/filetests/preopt/simplify.cton +++ b/cranelift/filetests/preopt/simplify.cton @@ -75,6 +75,6 @@ ebb0(v0: i32): ; sameln: function %irsub_imm ; nextln: ebb0(v0: i32): ; nextln: v1 = iconst.i32 2 -; nextln: v2 = irsub_imm v1, 2 +; nextln: v2 = irsub_imm v0, 2 ; nextln: return v2 ; nextln: } diff --git a/lib/cretonne/src/preopt.rs b/lib/cretonne/src/preopt.rs index bdd1c445eb..0a1c13d6ea 100644 --- a/lib/cretonne/src/preopt.rs +++ b/lib/cretonne/src/preopt.rs @@ -505,7 +505,7 @@ fn simplify(pos: &mut FuncCursor, inst: Inst) { new_opcode, ty, imm, - args[0], + args[1], ); } }