diff options
| author | Amara Emerson <aemerson@apple.com> | 2018-02-02 01:44:43 +0000 |
|---|---|---|
| committer | Amara Emerson <aemerson@apple.com> | 2018-02-02 01:44:43 +0000 |
| commit | 58aea52bc44fa93223489510a3da8a16a0353373 (patch) | |
| tree | ae7ee95b5d1d88bfa858f1fcaea766d40acb2add /llvm/lib | |
| parent | 59202324a5c0f07f9857910a776bc46c5dcc139d (diff) | |
| download | bcm5719-llvm-58aea52bc44fa93223489510a3da8a16a0353373.tar.gz bcm5719-llvm-58aea52bc44fa93223489510a3da8a16a0353373.zip | |
[GlobalISel] Constrain the dest reg of IMPLICT_DEF.
This fixes a crash where the user is a COPY, which deliberately does not
constrain its source operands, resulting in a vreg without a reg class escaping
selection.
Differential Revision: https://reviews.llvm.org/D42697
llvm-svn: 324047
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp b/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp index 34d0483c403..e9da954ee61 100644 --- a/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp +++ b/llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp @@ -1407,6 +1407,12 @@ bool AArch64InstructionSelector::select(MachineInstr &I, : selectVaStartAAPCS(I, MF, MRI); case TargetOpcode::G_IMPLICIT_DEF: I.setDesc(TII.get(TargetOpcode::IMPLICIT_DEF)); + const LLT DstTy = MRI.getType(I.getOperand(0).getReg()); + const unsigned DstReg = I.getOperand(0).getReg(); + const RegisterBank &DstRB = *RBI.getRegBank(DstReg, MRI, TRI); + const TargetRegisterClass *DstRC = + getRegClassForTypeOnBank(DstTy, DstRB, RBI); + RBI.constrainGenericRegister(DstReg, *DstRC, MRI); return true; } |

