aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2024-05-19 01:39:47 +0200
committerGitHub <noreply@github.com>2024-05-19 01:39:47 +0200
commit597ac471cc7da97ccf957362a7e9f7a52d6910ee (patch)
treea8ec8a674d7727d5815afe77ad699cba1fe4ada5 /clang/lib/CodeGen/CodeGenModule.cpp
parentc3677e45222a9461eed0224b99bd8ea19bc52bf6 (diff)
downloadllvm-597ac471cc7da97ccf957362a7e9f7a52d6910ee.zip
llvm-597ac471cc7da97ccf957362a7e9f7a52d6910ee.tar.gz
llvm-597ac471cc7da97ccf957362a7e9f7a52d6910ee.tar.bz2
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.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions