[PATCH] D86222: Fix PR46880: Fail CHECK-NOT with undefined variable

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 02:13:40 PDT 2020


grimar added a comment.

I am not well familar with the FileCheck logic probably to verify the code,
but following tests are failing for me with this diff applied:
(e.g.: Transforms/LoopVectorize/pr34681.ll fails with "error: uses undefined variable(s): "TEST"")

  LLVM :: CodeGen/AArch64/aarch64-tbz.ll
  LLVM :: CodeGen/AArch64/machine-outliner-retaddr-sign-thunk.ll
  LLVM :: CodeGen/AArch64/speculation-hardening.ll
  LLVM :: CodeGen/AMDGPU/amdgpu.private-memory.ll
  LLVM :: CodeGen/AMDGPU/private-memory-r600.ll
  LLVM :: CodeGen/Hexagon/hwloop3.ll
  LLVM :: CodeGen/Mips/sr1.ll
  LLVM :: CodeGen/PowerPC/ctrloops-softfloat.ll
  LLVM :: CodeGen/PowerPC/ppc-disable-non-volatile-cr.ll
  LLVM :: CodeGen/PowerPC/ppc-shrink-wrapping.ll
  LLVM :: CodeGen/PowerPC/ppc64-i128-abi.ll
  LLVM :: Transforms/CodeGenPrepare/ARM/sink-add-mul-shufflevector.ll
  LLVM :: Transforms/Coroutines/coro-split-sink-lifetime-02.ll
  LLVM :: Transforms/GVN/PRE/load-pre-nonlocal.ll
  LLVM :: Transforms/GVN/big-endian.ll
  LLVM :: Transforms/HardwareLoops/ARM/structure.ll
  LLVM :: Transforms/InferFunctionAttrs/annotate.ll
  LLVM :: Transforms/LoopVectorize/X86/x86-pr39099.ll
  LLVM :: Transforms/LoopVectorize/pr34681.ll
  LLVM :: Transforms/NewGVN/big-endian.ll

looks they all have undefined variables. So, seems this patch works well!
I've leaved 2 nits inline too.



================
Comment at: llvm/lib/Support/FileCheck.cpp:2013
+  if (!MatchErrors && !UndefVar)
+    return UndefVar;
   consumeError(std::move(MatchErrors));
----------------
Perhaps a bit cleaner would be to return `false`, since it it known that `UndefVar` is always `false` here.


================
Comment at: llvm/test/FileCheck/var-scope.txt:10
 RUN: %ProtectFileCheckOutput not FileCheck --check-prefixes CHECK,LOCAL1 --enable-var-scope --input-file %s %s 2>&1 \
 RUN:   | FileCheck --check-prefixes ERRUNDEF,ERRUNDEFLOCAL %s
 RUN: %ProtectFileCheckOutput not FileCheck --check-prefixes CHECK,LOCAL2 --enable-var-scope --input-file %s %s 2>&1 \
----------------
So, there are no `ERRUNDEF` check line anymore and seems you can remove it from here (and below) and switch to `--check-prefix` (just here)?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86222



More information about the llvm-commits mailing list