[PATCH] D148216: Add support for annotations in UpdateTestChecks (NFC)

Nikita Popov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 20 01:39:56 PDT 2023


nikic added a comment.

There are some test failures.

I believe there is one bug with the handling of unnamed globals. Previously we produced this:

  ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals --version 2
  ; RUN: opt -S < %s | FileCheck %s
  @0 = global i32 0
  
  ;.
  ; CHECK: @[[GLOB0:[0-9]+]] = global i32 0
  ;.
  define i32 @test() {
  ; CHECK-LABEL: define i32 @test() {
  ; CHECK-NEXT:    [[V:%.*]] = load i32, ptr @[[GLOB0]], align 4
  ; CHECK-NEXT:    ret i32 [[V]]
  ;
    %v = load i32, ptr @0
    ret i32 %v
  }

And now we instead check `CHECK: @0 = global i32 0`, so there is a mismatch between definition and use. I believe it does make sense to keep the wildcard names for unnamed globals.

On the same test case, if I keep rerunning update_test_checks on the same file, it keeps adding extra `CHECK: @0 = global i32 0` lines at the start (before the first `;.`. That didn't happen previously.



================
Comment at: clang/test/utils/update_cc_test_checks/Inputs/annotations.c:1
+// UTC_ARGS: --version 3
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fblocks -ftrivial-auto-var-init=zero %s -emit-llvm -o - | FileCheck %s
----------------
It would be more typical to pass `--version 3` when calling update_cc_test_checks. (Note that this is only a quirk of the test setup. Outside tests the `--version 3` is implied for new tests.)


================
Comment at: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.funcattrs.expected:9
 define ptr @foo(ptr %s) nounwind uwtable readnone optsize ssp {
-; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind optsize ssp willreturn memory(none) uwtable
+; CHECK: Function Attrs: nofree norecurse nosync nounwind optsize ssp willreturn memory(none) uwtable
 ; CHECK-LABEL: define {{[^@]+}}@foo
----------------
Huh, where does this change come from?


================
Comment at: llvm/utils/UpdateTestChecks/common.py:991
+    NamelessValue(r"META"       , "!" , r"![a-z.]+ "           , r"![0-9]+"             , None                 ) ,
+]
+
----------------
Does this still comply with the formatter?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148216



More information about the cfe-commits mailing list