From 342cdd89ce3ecff5705d2c6b868180805b25fc21 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Fri, 28 Oct 2016 22:42:54 +0000 Subject: [PATCH] SDAG: Make sure we use an allocatable reg class when we create this vreg As per the discussion on r280783, if constrainRegClass fails we need to call getAllocatableClass like we did before that commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285467 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/InstrEmitter.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/CodeGen/SelectionDAG/InstrEmitter.cpp b/lib/CodeGen/SelectionDAG/InstrEmitter.cpp index d760a70b1f3..3b91e58879b 100644 --- a/lib/CodeGen/SelectionDAG/InstrEmitter.cpp +++ b/lib/CodeGen/SelectionDAG/InstrEmitter.cpp @@ -338,6 +338,8 @@ InstrEmitter::AddRegisterOperand(MachineInstrBuilder &MIB, const TargetRegisterClass *ConstrainedRC = MRI->constrainRegClass(VReg, OpRC, MinRCSize); if (!ConstrainedRC) { + OpRC = TRI->getAllocatableClass(OpRC); + assert(OpRC && "Constraints cannot be fulfilled for allocation"); unsigned NewVReg = MRI->createVirtualRegister(OpRC); BuildMI(*MBB, InsertPos, Op.getNode()->getDebugLoc(), TII->get(TargetOpcode::COPY), NewVReg).addReg(VReg); -- 2.40.0