[llvm] [GlobalISel] Make IRTranslator able to handle PHIs with empty types. (PR #73235)

via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 23 04:18:06 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-globalisel

Author: Dávid Ferenc Szabó (dfszabo)

<details>
<summary>Changes</summary>

SelectionDAG already handle this since e53b7d1a11d180ed7b33190a837d8898ab2a0b71.

---
Full diff: https://github.com/llvm/llvm-project/pull/73235.diff


2 Files Affected:

- (modified) llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp (+2) 
- (modified) llvm/test/CodeGen/Generic/zero-sized-array.ll (+1) 


``````````diff
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

``````````

</details>


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


More information about the llvm-commits mailing list