Skip to content

Commit 7e1f66d

Browse files
author
Quentin Colombet
committed
[RegisterBankInfo] Allow to set a register class when nothing else is set
This is going to be needed to be able to constraint register class on target specific instruction while the RegBankSelect pass did not run yet. llvm-svn: 290375
1 parent b4e7118 commit 7e1f66d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,11 @@ const TargetRegisterClass *RegisterBankInfo::constrainGenericRegister(
224224
return MRI.constrainRegClass(Reg, &RC);
225225

226226
const RegisterBank *RB = RegClassOrBank.get<const RegisterBank *>();
227-
assert(RB && "Generic register does not have a register bank");
228-
229227
// Otherwise, all we can do is ensure the bank covers the class, and set it.
230-
if (!RB->covers(RC))
228+
if (RB && !RB->covers(RC))
231229
return nullptr;
232230

231+
// If nothing was set or the class is simply compatible, set it.
233232
MRI.setRegClass(Reg, &RC);
234233
return &RC;
235234
}

0 commit comments

Comments
 (0)