diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2021-03-05 19:12:59 +0100 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2021-03-05 19:12:59 +0100 |
| commit | 7a6ea77473949c9a74712c09e7a2654e0ba8258b (patch) | |
| tree | adbb6c4264e9bd3e28f196a5e66664a22c6c1ea7 /compiler/rustc_codegen_cranelift/src/optimize/peephole.rs | |
| parent | 8fd946c63a6c3aae9788bd459d278cb2efa77099 (diff) | |
| parent | 9a0c32934ebe376128230aa8da3275697b2053e7 (diff) | |
| download | rust-7a6ea77473949c9a74712c09e7a2654e0ba8258b.tar.gz rust-7a6ea77473949c9a74712c09e7a2654e0ba8258b.zip | |
Merge commit '9a0c32934ebe376128230aa8da3275697b2053e7' into sync_cg_clif-2021-03-05
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src/optimize/peephole.rs')
| -rw-r--r-- | compiler/rustc_codegen_cranelift/src/optimize/peephole.rs | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/optimize/peephole.rs b/compiler/rustc_codegen_cranelift/src/optimize/peephole.rs index a575ed8dc35..b95e2d72877 100644 --- a/compiler/rustc_codegen_cranelift/src/optimize/peephole.rs +++ b/compiler/rustc_codegen_cranelift/src/optimize/peephole.rs @@ -10,10 +10,7 @@ use cranelift_frontend::FunctionBuilder; pub(crate) fn maybe_unwrap_bint(bcx: &mut FunctionBuilder<'_>, arg: Value) -> Value { if let ValueDef::Result(arg_inst, 0) = bcx.func.dfg.value_def(arg) { match bcx.func.dfg[arg_inst] { - InstructionData::Unary { - opcode: Opcode::Bint, - arg, - } => arg, + InstructionData::Unary { opcode: Opcode::Bint, arg } => arg, _ => arg, } } else { @@ -54,12 +51,7 @@ pub(crate) fn make_branchable_value(bcx: &mut FunctionBuilder<'_>, arg: Value) - match bcx.func.dfg[arg_inst] { // This is the lowering of Rvalue::Not - InstructionData::Load { - opcode: Opcode::Load, - arg: ptr, - flags, - offset, - } => { + InstructionData::Load { opcode: Opcode::Load, arg: ptr, flags, offset } => { // Using `load.i8 + uextend.i32` would legalize to `uload8 + ireduce.i8 + // uextend.i32`. Just `uload8` is much faster. match bcx.func.dfg.ctrl_typevar(arg_inst) { @@ -95,20 +87,14 @@ pub(crate) fn maybe_known_branch_taken( }; match bcx.func.dfg[arg_inst] { - InstructionData::UnaryBool { - opcode: Opcode::Bconst, - imm, - } => { + InstructionData::UnaryBool { opcode: Opcode::Bconst, imm } => { if test_zero { Some(!imm) } else { Some(imm) } } - InstructionData::UnaryImm { - opcode: Opcode::Iconst, - imm, - } => { + InstructionData::UnaryImm { opcode: Opcode::Iconst, imm } => { if test_zero { Some(imm.bits() == 0) } else { |
