GlobalISel: Handle selection of G_IMPLICIT_DEF in AArch64

A generic variant of IMPLICIT_DEF was added in r306875, but this
survives to selection and hits a `Cannot Select`. Add handling that
converts the note to a regular IMPLICIT_DEF.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307817 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Justin Bogner 2017-07-12 17:32:32 +00:00
parent 7c497afb63
commit 356d2bfeba
2 changed files with 33 additions and 0 deletions

View File

@ -1325,6 +1325,9 @@ bool AArch64InstructionSelector::select(MachineInstr &I) const {
case TargetOpcode::G_VASTART:
return STI.isTargetDarwin() ? selectVaStartDarwin(I, MF, MRI)
: selectVaStartAAPCS(I, MF, MRI);
case TargetOpcode::G_IMPLICIT_DEF:
I.setDesc(TII.get(TargetOpcode::IMPLICIT_DEF));
return true;
}
return false;

View File

@ -0,0 +1,30 @@
# RUN: llc -O0 -mtriple=aarch64-- -run-pass=instruction-select -verify-machineinstrs -global-isel %s -o - | FileCheck %s
--- |
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
define void @implicit_def() { ret void }
...
---
# CHECK-LABEL: name: implicit_def
name: implicit_def
legalized: true
regBankSelected: true
# CHECK: registers:
# CHECK-NEXT: - { id: 0, class: gpr32, preferred-register: '' }
# CHECK-NEXT: - { id: 1, class: gpr32, preferred-register: '' }
registers:
- { id: 0, class: gpr }
- { id: 1, class: gpr }
# CHECK: body:
# CHECK: [[DEF:%[0-9]+]] = IMPLICIT_DEF
# CHECK: [[ADD:%[0-9]+]] = ADDWrr [[DEF]], [[DEF]]
# CHECK: %w0 = COPY [[ADD]]
body: |
bb.0:
%0(s32) = G_IMPLICIT_DEF
%1(s32) = G_ADD %0, %0
%w0 = COPY %1(s32)
...