[llvm] r331820 - [globalisel] Correct r331816 to check the opcode before calling getOperand().
Daniel Sanders via llvm-commits
llvm-commits at lists.llvm.org
Tue May 8 15:58:35 PDT 2018
Author: dsanders
Date: Tue May 8 15:58:35 2018
New Revision: 331820
URL: http://llvm.org/viewvc/llvm-project?rev=331820&view=rev
Log:
[globalisel] Correct r331816 to check the opcode before calling getOperand().
Fix a silly mistake in my pre-commit changes for r331816. It should check what
opcode the insn is before extracting the operands.
NFC at the moment since the caller already checked the opcode.
Modified:
llvm/trunk/lib/CodeGen/GlobalISel/CombinerHelper.cpp
Modified: llvm/trunk/lib/CodeGen/GlobalISel/CombinerHelper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/CombinerHelper.cpp?rev=331820&r1=331819&r2=331820&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/CombinerHelper.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/CombinerHelper.cpp Tue May 8 15:58:35 2018
@@ -37,14 +37,14 @@ bool CombinerHelper::tryCombineCopy(Mach
}
bool CombinerHelper::tryCombineExtendingLoads(MachineInstr &MI) {
- unsigned DstReg = MI.getOperand(0).getReg();
- unsigned SrcReg = MI.getOperand(1).getReg();
-
if (MI.getOpcode() != TargetOpcode::G_ANYEXT &&
MI.getOpcode() != TargetOpcode::G_SEXT &&
MI.getOpcode() != TargetOpcode::G_ZEXT)
return false;
+ unsigned DstReg = MI.getOperand(0).getReg();
+ unsigned SrcReg = MI.getOperand(1).getReg();
+
LLT DstTy = MRI.getType(DstReg);
if (!DstTy.isScalar())
return false;
@@ -69,5 +69,5 @@ bool CombinerHelper::tryCombineExtending
bool CombinerHelper::tryCombine(MachineInstr &MI) {
if (tryCombineCopy(MI))
return true;
- return tryCombineExtendingLoads(MI);;
+ return tryCombineExtendingLoads(MI);
}
More information about the llvm-commits
mailing list