[PATCH] D62617: [MIR-Canon] Fixing case where MachineFunction is empty.

Puyan Lotfi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 30 14:35:53 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL362158: [MIR-Canon] Fixing case where MachineFunction is empty. (authored by zer0, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62617?vs=202300&id=202303#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62617/new/

https://reviews.llvm.org/D62617

Files:
  llvm/trunk/lib/CodeGen/MIRCanonicalizerPass.cpp
  llvm/trunk/test/CodeGen/MIR/AArch64/empty-MF.mir


Index: llvm/trunk/lib/CodeGen/MIRCanonicalizerPass.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/MIRCanonicalizerPass.cpp
+++ llvm/trunk/lib/CodeGen/MIRCanonicalizerPass.cpp
@@ -104,6 +104,8 @@
                     "Rename Register Operands Canonically", false, false)
 
 static std::vector<MachineBasicBlock *> GetRPOList(MachineFunction &MF) {
+  if (MF.empty())
+    return {};
   ReversePostOrderTraversal<MachineBasicBlock *> RPOT(&*MF.begin());
   std::vector<MachineBasicBlock *> RPOList;
   for (auto MBB : RPOT) {
Index: llvm/trunk/test/CodeGen/MIR/AArch64/empty-MF.mir
===================================================================
--- llvm/trunk/test/CodeGen/MIR/AArch64/empty-MF.mir
+++ llvm/trunk/test/CodeGen/MIR/AArch64/empty-MF.mir
@@ -0,0 +1,11 @@
+# RUN: llc -mtriple aarch64-- -run-pass mir-canonicalizer %s -o - | FileCheck %s
+# CHECK: ...
+# CHECK-NEXT: ---
+# CHECK-NEXT: name:            foo
+# CHECK: body:             |
+# CHECK-EMPTY:
+# CHECK-NEXT: ...
+---
+name: foo
+body:             |
+...


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62617.202303.patch
Type: text/x-patch
Size: 1081 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190530/5aad14bd/attachment.bin>


More information about the llvm-commits mailing list