about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2020-08-14 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2020-08-14 21:58:10 +0200
commit60d7d28948c1a3d5125f12a2254f6edb5077c4c9 (patch)
tree3bc603dcfdcf8fed997a163592c71dc3ed79c3e9
parentfd740266de93f89195eee78a0feaa770bf90a47e (diff)
downloadrust-60d7d28948c1a3d5125f12a2254f6edb5077c4c9.tar.gz
rust-60d7d28948c1a3d5125f12a2254f6edb5077c4c9.zip
MatchBranchSimplification: optimize when switching on copy operand
-rw-r--r--src/librustc_mir/transform/match_branches.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc_mir/transform/match_branches.rs b/src/librustc_mir/transform/match_branches.rs
index 67021ae512b..e6c5845cd48 100644
--- a/src/librustc_mir/transform/match_branches.rs
+++ b/src/librustc_mir/transform/match_branches.rs
@@ -16,7 +16,7 @@ impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
         'outer: for bb_idx in bbs.indices() {
             let (discr, val, switch_ty, first, second) = match bbs[bb_idx].terminator().kind {
                 TerminatorKind::SwitchInt {
-                    discr: Operand::Move(ref place),
+                    discr: Operand::Copy(ref place) | Operand::Move(ref place),
                     switch_ty,
                     ref targets,
                     ref values,