From 924f31bc3c2c765f51eedda14534623053ffd75a Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Sat, 15 Aug 2020 10:26:21 -0400 Subject: [PATCH] GlobalISel: Remove unnecessary check for copy type COPY isn't allowed to change the type, but can mix no type with type. --- llvm/include/llvm/CodeGen/GlobalISel/Utils.h | 5 ++--- llvm/lib/CodeGen/GlobalISel/Utils.cpp | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/llvm/include/llvm/CodeGen/GlobalISel/Utils.h b/llvm/include/llvm/CodeGen/GlobalISel/Utils.h index c0ca4a841b3a..23dc05c4e157 100644 --- a/llvm/include/llvm/CodeGen/GlobalISel/Utils.h +++ b/llvm/include/llvm/CodeGen/GlobalISel/Utils.h @@ -151,9 +151,8 @@ const ConstantFP* getConstantFPVRegVal(Register VReg, MachineInstr *getOpcodeDef(unsigned Opcode, Register Reg, const MachineRegisterInfo &MRI); -/// Find the def instruction for \p Reg, folding away any trivial copies. Note -/// it may still return a COPY, if it changes the type. May return nullptr if \p -/// Reg is not a generic virtual register. +/// Find the def instruction for \p Reg, folding away any trivial copies. May +/// return nullptr if \p Reg is not a generic virtual register. MachineInstr *getDefIgnoringCopies(Register Reg, const MachineRegisterInfo &MRI); diff --git a/llvm/lib/CodeGen/GlobalISel/Utils.cpp b/llvm/lib/CodeGen/GlobalISel/Utils.cpp index cf5ff54e492d..d598bf8b5a53 100644 --- a/llvm/lib/CodeGen/GlobalISel/Utils.cpp +++ b/llvm/lib/CodeGen/GlobalISel/Utils.cpp @@ -365,7 +365,7 @@ getDefSrcRegIgnoringCopies(Register Reg, const MachineRegisterInfo &MRI) { while (DefMI->getOpcode() == TargetOpcode::COPY) { Register SrcReg = DefMI->getOperand(1).getReg(); auto SrcTy = MRI.getType(SrcReg); - if (!SrcTy.isValid() || SrcTy != DstTy) + if (!SrcTy.isValid()) break; DefMI = MRI.getVRegDef(SrcReg); DefSrcReg = SrcReg;