[llvm] r295827 - [GlobalISel] Fix compiler warnings and make assert assert something.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 22 04:59:48 PST 2017
Author: d0k
Date: Wed Feb 22 06:59:47 2017
New Revision: 295827
URL: http://llvm.org/viewvc/llvm-project?rev=295827&view=rev
Log:
[GlobalISel] Fix compiler warnings and make assert assert something.
Modified:
llvm/trunk/lib/Target/X86/X86InstructionSelector.cpp
llvm/trunk/lib/Target/X86/X86InstructionSelector.h
llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
Modified: llvm/trunk/lib/Target/X86/X86InstructionSelector.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstructionSelector.cpp?rev=295827&r1=295826&r2=295827&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstructionSelector.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstructionSelector.cpp Wed Feb 22 06:59:47 2017
@@ -37,10 +37,9 @@ using namespace llvm;
#include "X86GenGlobalISel.inc"
-X86InstructionSelector::X86InstructionSelector(const X86TargetMachine &TM,
- const X86Subtarget &STI,
+X86InstructionSelector::X86InstructionSelector(const X86Subtarget &STI,
const X86RegisterBankInfo &RBI)
- : InstructionSelector(), TM(TM), STI(STI), TII(*STI.getInstrInfo()),
+ : InstructionSelector(), TII(*STI.getInstrInfo()),
TRI(*STI.getRegisterInfo()), RBI(RBI) {}
// FIXME: This should be target-independent, inferred from the types declared
@@ -70,6 +69,7 @@ static bool selectCopy(MachineInstr &I,
const RegisterBank &RegBank = *RBI.getRegBank(DstReg, MRI, TRI);
const unsigned DstSize = MRI.getType(DstReg).getSizeInBits();
+ (void)DstSize;
unsigned SrcReg = I.getOperand(1).getReg();
const unsigned SrcSize = RBI.getSizeInBits(SrcReg, MRI, TRI);
(void)SrcSize;
@@ -124,10 +124,8 @@ bool X86InstructionSelector::select(Mach
return true;
}
- if (I.getNumOperands() != I.getNumExplicitOperands()) {
- assert("Generic instruction has unexpected implicit operands\n");
- return false;
- }
+ assert(I.getNumOperands() == I.getNumExplicitOperands() &&
+ "Generic instruction has unexpected implicit operands\n");
return selectImpl(I);
}
Modified: llvm/trunk/lib/Target/X86/X86InstructionSelector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstructionSelector.h?rev=295827&r1=295826&r2=295827&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstructionSelector.h (original)
+++ llvm/trunk/lib/Target/X86/X86InstructionSelector.h Wed Feb 22 06:59:47 2017
@@ -25,7 +25,7 @@ class X86TargetMachine;
class X86InstructionSelector : public InstructionSelector {
public:
- X86InstructionSelector(const X86TargetMachine &TM, const X86Subtarget &STI,
+ X86InstructionSelector(const X86Subtarget &STI,
const X86RegisterBankInfo &RBI);
bool select(MachineInstr &I) const override;
@@ -35,8 +35,6 @@ private:
/// the patterns that don't require complex C++.
bool selectImpl(MachineInstr &I) const;
- const X86TargetMachine &TM;
- const X86Subtarget &STI;
const X86InstrInfo &TII;
const X86RegisterInfo &TRI;
const X86RegisterBankInfo &RBI;
Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=295827&r1=295826&r2=295827&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Wed Feb 22 06:59:47 2017
@@ -284,7 +284,7 @@ X86TargetMachine::getSubtargetImpl(const
auto *RBI = new X86RegisterBankInfo(*I->getRegisterInfo());
GISel->RegBankInfo.reset(RBI);
- GISel->InstSelector.reset(new X86InstructionSelector(*this, *I, *RBI));
+ GISel->InstSelector.reset(new X86InstructionSelector(*I, *RBI));
#endif
I->setGISelAccessor(*GISel);
More information about the llvm-commits
mailing list