In cases where the machine function is empty: bail on the RPO traversal.
Differential Revision: https://reviews.llvm.org/D62617
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362158
91177308-0d34-0410-b5e6-
96231b3b80d8
"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) {
--- /dev/null
+# 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: |
+...