[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 04:17:35 PST 2023


https://github.com/dfszabo created https://github.com/llvm/llvm-project/pull/73235

SelectionDAG already handle this since e53b7d1a11d180ed7b33190a837d8898ab2a0b71.

>From 39d68a11b844ebe060a969fb00a4addfd2799218 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..ac6fa144fa46bcf 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