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

Justin Bogner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 30 11:41:51 PDT 2019


bogner added inline comments.


================
Comment at: llvm/test/CodeGen/MIR/AArch64/empty-MF.mir:1-2
+# RUN: llc -mtriple aarch64-- -run-pass mir-canonicalizer %s -o %t \
+# RUN:   -verify-machineinstrs
+
----------------
Probably best to `FileCheck` that we get an empty function rather than just "not crashing"


================
Comment at: llvm/test/CodeGen/MIR/AArch64/empty-MF.mir:2
+# RUN: llc -mtriple aarch64-- -run-pass mir-canonicalizer %s -o %t \
+# RUN:   -verify-machineinstrs
+
----------------
Why `-verify-machineinstrs`? There aren't any...


================
Comment at: llvm/test/CodeGen/MIR/AArch64/empty-MF.mir:4-8
+--- |
+  define void @foo() {
+    ret void
+  }
+...
----------------
This is kind of a confusing way to do this - the function certainly doesn't look empty and you're relying on the fact that not providing the mir gives us something empty-ish. I'd probably drop the IR completely and write out the mir you want:
```
---
name: foo
body:             |
...
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62617





More information about the llvm-commits mailing list