forked from OSchip/llvm-project
[MIR-Canon] Fixing case where MachineFunction is empty.
In cases where the machine function is empty: bail on the RPO traversal. Differential Revision: https://reviews.llvm.org/D62617 llvm-svn: 362158
This commit is contained in:
parent
fc3dfd3e35
commit
daaecf98c9
|
@ -104,6 +104,8 @@ INITIALIZE_PASS_END(MIRCanonicalizer, "mir-canonicalizer",
|
|||
"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) {
|
||||
|
|
|
@ -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: |
|
||||
...
|
Loading…
Reference in New Issue