This is an archive of the discontinued LLVM Phabricator instance.

[FileCheck] Default --allow-unused-prefixes to false
ClosedPublic

Authored by MaskRay on Feb 1 2021, 11:07 PM.

Details

Summary

Link: https://lists.llvm.org/pipermail/llvm-dev/2020-October/146162.html "[RFC] FileCheck: (dis)allowing unused prefixes"

If a downstream project using lit needs time for transition,
add the following to lit.local.cfg:

from lit.llvm.subst import ToolSubst

fc = ToolSubst('FileCheck', unresolved='fatal')
config.substitutions.insert(0, (fc.regex, 'FileCheck --allow-unused-prefixes'))

Diff Detail

Event Timeline

MaskRay created this revision.Feb 1 2021, 11:07 PM
MaskRay requested review of this revision.Feb 1 2021, 11:07 PM
Herald added a reviewer: baziotis. · View Herald Transcript
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
MaskRay edited the summary of this revision. (Show Details)Feb 1 2021, 11:14 PM
MaskRay edited the summary of this revision. (Show Details)Feb 1 2021, 11:17 PM
jhenderson accepted this revision.Feb 2 2021, 12:58 AM

I assume this now runs cleanly. If so, LGTM. Probably worth mentioning on the mailing list thread too, so wrap up that conversation. By the way, did we ever figure out how many of the failures were genuine bugs versus deliberate isntances?

This revision is now accepted and ready to land.Feb 2 2021, 12:58 AM

I assume this now runs cleanly. If so, LGTM. Probably worth mentioning on the mailing list thread too, so wrap up that conversation. By the way, did we ever figure out how many of the failures were genuine bugs versus deliberate isntances?

Except for the tests under llvm/test/Transforms/Attributor/, which D94744 explicitly opts into allowing unused prefixes (and which @jdoerfert described as intentionally so), the rest (~1300) were bugs: i.e. unintentionally unused prefixes.

Out of them, a small handful were spelling mistakes (identified as such during code review by their authors) and fixed rather than removed.

nikic added a subscriber: nikic.Feb 2 2021, 7:09 AM

Just to be clear here: Only the small handful where a spelling mistake was fixed were actually bugs. All other unused check prefixes were there for convenience, and are now casualties of this unnecessary crusade. I regret not speaking out against this at the time.

Just to be clear here: Only the small handful where a spelling mistake was fixed were actually bugs. All other unused check prefixes were there for convenience, and are now casualties of this unnecessary crusade. I regret not speaking out against this at the time.

Hi, I think the situation is the converse: most are code smell, only a small handful of tests leverage this property. So far the most convincing usage is something like (a) --check-prefix=%something where %something can expand to multiple prefixes and (b) a customized tool integrating FileCheck feature which expands to multiple prefixes, some prefixes may be omitted.

Issues include (a) misspelled prefixes (b) bitrot prefixes due to refactoring (c) omitted -NOT patterns (e.g. some tests use --check-prefixes=CHECK,CHECK-C for C specific UB and --check-prefixes=CHECK,CHECK-CPP. CHECK-CPP was absent but was intended to be a CHECK-CPP-NOT:)

I think the good uses of --allow-unused-prefixes=true are much fewer than the opposite.

MaskRay updated this revision to Diff 321524.Feb 4 2021, 11:24 AM
MaskRay edited the summary of this revision. (Show Details)

Rebase to re-cycle bots

@nikic D95849 has already changed llvm/test/ to default to --allow-unused-prefixes. I updated a few directories to be --allow-unused-prefixes clean (this uncovered improvement to many tests).

Some update{,_llc,_analyzer}_test_checks.py use cases may find --allow-unused-prefixes=false mode better, but such use cases still appear to be a minority (e.g. @RKSimon/@pengfei/my/others' fixes to test/CodeGen directories).
https://lists.llvm.org/pipermail/llvm-dev/2021-February/148331.html

This revision was landed with ongoing or failed builds.Feb 8 2021, 1:37 PM
This revision was automatically updated to reflect the committed changes.
llvm/test/FileCheck/lit.local.cfg