summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp b/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp
index 34ec509b8ac..a6c93bc0f3d 100644
--- a/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp
@@ -224,12 +224,11 @@ const TargetRegisterClass *RegisterBankInfo::constrainGenericRegister(
return MRI.constrainRegClass(Reg, &RC);
const RegisterBank *RB = RegClassOrBank.get<const RegisterBank *>();
- assert(RB && "Generic register does not have a register bank");
-
// Otherwise, all we can do is ensure the bank covers the class, and set it.
- if (!RB->covers(RC))
+ if (RB && !RB->covers(RC))
return nullptr;
+ // If nothing was set or the class is simply compatible, set it.
MRI.setRegClass(Reg, &RC);
return &RC;
}
OpenPOWER on IntegriCloud