[all-commits] [llvm/llvm-project] 597ac4: update_test_checks: match IR basic block labels (#...

Nicolai Hähnle via All-commits all-commits at lists.llvm.org
Sat May 18 16:40:09 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 597ac471cc7da97ccf957362a7e9f7a52d6910ee
      https://github.com/llvm/llvm-project/commit/597ac471cc7da97ccf957362a7e9f7a52d6910ee
  Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
  Date:   2024-05-19 (Sun, 19 May 2024)

  Changed paths:
    M llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/phi-labels.ll.expected
    M llvm/test/tools/UpdateTestChecks/update_test_checks/phi-labels.test
    M llvm/utils/UpdateTestChecks/asm.py
    M llvm/utils/UpdateTestChecks/common.py
    M llvm/utils/UpdateTestChecks/isel.py
    M llvm/utils/update_analyze_test_checks.py
    M llvm/utils/update_cc_test_checks.py
    M llvm/utils/update_llc_test_checks.py
    M llvm/utils/update_test_checks.py

  Log Message:
  -----------
  update_test_checks: match IR basic block labels (#88979)

Labels are matched using a regexp of the form '^(pattern):', which
requires the addition of a "suffix" concept to NamelessValue.

Aside from that, the key challenge is that block labels are values, and
we typically capture values including the prefix '%'. However, when
labels appear at the start of a basic block, the prefix '%' is not
included, so we must capture block label values *without* the prefix
'%'.

We don't know ahead of time whether an IR value is a label or not. In
most cases, they are prefixed by the word "label" (their type), but this
isn't the case in phi nodes. We solve this issue by leveraging the
two-phase nature of variable generalization: the first pass finds all
occurences of a variable and determines whether the '%' prefix can be
included or not. The second pass does the actual substitution.

This change also unifies the generalization path for assembly with that
for IR and analysis, in the hope that any future changes avoid diverging
those cases future.

I also considered the alternative of trying to detect the phi node case
using more regular expression special cases but ultimately decided
against that because it seemed more fragile, and perhaps the approach of
keeping a tentative prefix that may later be discarded could also be
eventually applied to some metadata and attribute cases.

Note that an early version of this change was reviewed as
https://reviews.llvm.org/D142452, before version numbers were
introduced. This is a substantially updated version of that change.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list