In global Isel there may be no register class for a virtual register. In
that case we can invoke MRI->getRegClass(). We should invoke
MRI->getRegClassOrNull() instead and check if it returns nullptr.
Details
- Reviewers
thakis xiangzhangllvm nikic arsenm MatzeB
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
I can confirm this fixes the reproducer I posted on https://reviews.llvm.org/D126771.
llvm/lib/CodeGen/RegAllocFast.cpp | ||
---|---|---|
307–310 | This should not happen. This is a bug in x86 globalisel. Virtual registers without a class should not get past the selector. The verifier should catch this |
llvm/lib/CodeGen/RegAllocFast.cpp | ||
---|---|---|
307–310 | I'm not familiar with globalisel, but there is no harm for this patch. It just trigger the bug of globalisel. Can we land it first to let the lit test pass? We can debug and create another patch for globalisel if there is a bug in it. |
llvm/lib/CodeGen/RegAllocFast.cpp | ||
---|---|---|
307–310 | We can't trigger the bug with -verify-machineinstrs. There may be a bug in handling DBG_VALUE in globalisel. However I think it is irrelevant to this patch. |
llvm/lib/CodeGen/RegAllocFast.cpp | ||
---|---|---|
307–310 | No, this is a hack. The virtual register here should have been constrained to a real class |
llvm/lib/CodeGen/RegAllocFast.cpp | ||
---|---|---|
307–310 | That's the bug of globalisel, but we need more time to root cause it and fix it. Here we just avoid triggerring the bug and don't block others' work. When globalisel bug is fixed we can change back to getRegClass(). What do you think? |
llvm/lib/CodeGen/RegAllocFast.cpp | ||
---|---|---|
307–310 | How about add "FIXME" for the patch? |
Are you sure your bot touble actually comes from GlobalIsel? While GIsel is unfinished and likely broken on x86 it also shouldn‘t be enabled anywhere except a few dedicated globalisel tests…
This should not happen. This is a bug in x86 globalisel. Virtual registers without a class should not get past the selector. The verifier should catch this