[PATCH] D90829: [GlobalISel][TableGen] fix seg fault for zero instruction

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 12 05:16:22 PST 2020


bjope added inline comments.


================
Comment at: llvm/test/TableGen/GlobalISelEmitter-zero-instr.td:6
+
+// CHECK: return MatchTable
+def : Pat<(zext (i16 (trunc i32:$src))),
----------------
ehjogab wrote:
> ehjogab wrote:
> > bjope wrote:
> > > Nice that we no longer crash, but I don't know how relevant this check is. What about checking that we get the "warning: Skipped pattern: Dst pattern root isn't a known leaf" message instead?
> > That'd be nice, but can it be done? I'm not very familiar with FileCheck... 
> I missed to mention that this check at least checks that we no longer crashes, so it's not entirely useless.
One solution could be to do `-o /dev/null` and `... 2>&1 | FileCheck %s`, to simply ignore regular output, and FileCheck on both stdout and stderr (in case the warning is printed on stderr).

I'm not sure exactly how tblgen emit those warnings, which stream, or if it is conditional based on how the binary is built (e.g. using `-debug` in test cases usually also require that you add `// REQUIRES: asserts` to avoid running the test case when debug support isn't included.

But I think that simply checking for the warning would work here. FileCheck is just doing pattern matching on it's input.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90829



More information about the llvm-commits mailing list