[llvm] [GlobalISel] Make IRTranslator able to handle PHIs with empty types. (PR #73235)
Dávid Ferenc Szabó via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 23 06:12:13 PST 2023
https://github.com/dfszabo updated https://github.com/llvm/llvm-project/pull/73235
>From ad72e10d749239012b0721c9e171a77dfe5a9af2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?D=C3=A1vid=20Ferenc=20Szab=C3=B3?=
<szabodavidferenc at gmail.com>
Date: Thu, 23 Nov 2023 13:11:26 +0100
Subject: [PATCH] [GlobalISel] Make IRTranslator able to handle PHIs with empty
types.
SelectionDAG already handle this since e53b7d1a11d180ed7b33190a837d8898ab2a0b71.
---
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | 2 ++
llvm/test/CodeGen/Generic/zero-sized-array.ll | 1 +
2 files changed, 3 insertions(+)
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
index 62450e4c43ff3e6..f82d4f75ff62827 100644
--- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -3118,6 +3118,8 @@ void IRTranslator::finishPendingPhis() {
#endif // ifndef NDEBUG
for (auto &Phi : PendingPHIs) {
const PHINode *PI = Phi.first;
+ if (PI->getType()->isEmptyTy())
+ continue;
ArrayRef<MachineInstr *> ComponentPHIs = Phi.second;
MachineBasicBlock *PhiMBB = ComponentPHIs[0]->getParent();
EntryBuilder->setDebugLoc(PI->getDebugLoc());
diff --git a/llvm/test/CodeGen/Generic/zero-sized-array.ll b/llvm/test/CodeGen/Generic/zero-sized-array.ll
index 05fa5686106df92..75d65173a08091b 100644
--- a/llvm/test/CodeGen/Generic/zero-sized-array.ll
+++ b/llvm/test/CodeGen/Generic/zero-sized-array.ll
@@ -1,4 +1,5 @@
; RUN: llc < %s
+; RUN: llc -O0 -mtriple=aarch64 -global-isel < %s
; PR9900
; NVPTX does not support zero sized type arg
More information about the llvm-commits
mailing list