This is an archive of the discontinued LLVM Phabricator instance.

[Utils] Add prefix parameter in update test checks to avoid FileCheck conflicts
ClosedPublic

Authored by ggeorgakoudis on Mar 26 2021, 6:29 AM.

Details

Summary

IR values convert to check prefix FileCheck variables for IR checks. For example, nameless values, e.g., %0, convert to check prefix TMP FileCheck variables, e.g., [[TMP0:%.*]]. This check prefix may clash with named values that have the same name and that causes auto-generated tests to fail. Currently a warning is emitted to change the names of the IR values but this is not always possible, if for example they are generated by clang. Manual intervention to fix the FileCheck variable names is too tedious. This patch add a parameter to prefix conflicting FileCheck variable names with a user-provided string to automate the process.

Diff Detail

Event Timeline

ggeorgakoudis created this revision.Mar 26 2021, 6:29 AM
ggeorgakoudis requested review of this revision.Mar 26 2021, 6:29 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 26 2021, 6:29 AM
ggeorgakoudis edited the summary of this revision. (Show Details)Mar 26 2021, 6:38 AM
ggeorgakoudis added a reviewer: jdoerfert.
jdoerfert accepted this revision.Mar 26 2021, 7:16 AM

Cool, thanks. LGTM, two nits.

llvm/utils/UpdateTestChecks/common.py
532

Move the re.match into a helper (also used below), maybe: may_clash_with_default_check_prefix_name(check_prefix, var)

563

I would not add the and not _prefix_filecheck... stuff here because if the other condition holds a warning seems appropriate, maybe the prefix was chosen pooreley, etc.

This revision is now accepted and ready to land.Mar 26 2021, 7:16 AM
ggeorgakoudis marked an inline comment as done.

Update for comments

ggeorgakoudis marked an inline comment as done.Mar 26 2021, 10:26 AM