[PATCH] D99287: [GlobalISel] Fix crash in RBS with a non-generic IMPLICIT_DEF.
Amara Emerson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 24 11:31:26 PDT 2021
aemerson created this revision.
aemerson added reviewers: paquette, arsenm.
aemerson added a project: LLVM.
Herald added subscribers: hiraditya, rovka.
aemerson requested review of this revision.
Herald added a subscriber: wdng.
This may occur when swifterror codegen in the translator generates these, but we shouldn't try to handle them since they should have regclasses anyway.
rdar://75784009
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D99287
Files:
llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp
llvm/test/CodeGen/AArch64/GlobalISel/implicit_def_rbs_crash.mir
Index: llvm/test/CodeGen/AArch64/GlobalISel/implicit_def_rbs_crash.mir
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/GlobalISel/implicit_def_rbs_crash.mir
@@ -0,0 +1,22 @@
+# RUN: llc -O0 -mtriple arm64-- -run-pass=regbankselect -verify-machineinstrs %s -o - | FileCheck %s
+
+# Check we don't crash given an non-generic implicit_def. These may
+# come from swifterror handling in the translator.
+# CHECK: IMPLICIT_DEF
+---
+name: implicit_def_crash
+alignment: 4
+legalized: true
+regBankSelected: false
+selected: false
+failedISel: false
+registers:
+ - { id: 0, class: gpr64all, preferred-register: '' }
+ - { id: 1, class: _, preferred-register: '' }
+ - { id: 2, class: gpr64all, preferred-register: '' }
+ - { id: 3, class: gpr64all, preferred-register: '' }
+body: |
+ bb.1:
+ %0:gpr64all = IMPLICIT_DEF
+
+...
Index: llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp
===================================================================
--- llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp
+++ llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp
@@ -719,6 +719,10 @@
if (MI.isDebugInstr())
continue;
+ // Ignore IMPLICIT_DEF which must have a regclass.
+ if (MI.isImplicitDef())
+ continue;
+
if (!assignInstr(MI)) {
reportGISelFailure(MF, *TPC, *MORE, "gisel-regbankselect",
"unable to map instruction", MI);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99287.333069.patch
Type: text/x-patch
Size: 1505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210324/5d600980/attachment.bin>
More information about the llvm-commits
mailing list