[PATCH] D30480: [CodeGen] Add a basic MachineInstr unittest. NFC.

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 28 16:40:03 PST 2017


MatzeB accepted this revision.
MatzeB added a comment.
This revision is now accepted and ready to land.

So much boilerplate, but this is in line with the existing unittests/MI/LiveIntervalTest.cpp or unittests/Target/AArch64/InstSizes.cpp. LGTM.

BTW: I plan to present an alternative approach soon that introduces a special lcl testing pass that understands simple directive... But there is no reason to wait for that.



================
Comment at: unittests/CodeGen/MachineInstrTest.cpp:35-36
+  return std::unique_ptr<TargetMachine>(
+      T.createTargetMachine(/*TT=*/"", /*CPU=*/"", /*Features=*/"",
+                            TargetOptions(), /*RelocModel=*/None));
+}
----------------
I assume this selects LLVM_DEFAULT_TARGET_TRIPLE. Would this fail if that isn't defined? The test should at least exit gracefully and not segfault in that case...


https://reviews.llvm.org/D30480





More information about the llvm-commits mailing list