From: Jan Korous Date: Tue, 10 May 2022 21:03:48 +0000 (-0700) Subject: Revert "[utils] Avoid hardcoding metadata ids in update_cc_test_checks" X-Git-Tag: upstream/15.0.7~8086 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0376c0f271398147b3df79ab20ffb2f375e47215;p=platform%2Fupstream%2Fllvm.git Revert "[utils] Avoid hardcoding metadata ids in update_cc_test_checks" This reverts commit ce583b14b2ec37b1c168bb92020680cb452502b3. --- diff --git a/clang/test/utils/update_cc_test_checks/Inputs/annotation-id.c b/clang/test/utils/update_cc_test_checks/Inputs/annotation-id.c deleted file mode 100644 index 49c7c58..0000000 --- a/clang/test/utils/update_cc_test_checks/Inputs/annotation-id.c +++ /dev/null @@ -1,5 +0,0 @@ -// RUN: %clang_cc1 -ftrivial-auto-var-init=zero -triple=x86_64-unknown-linux-gnu -O1 -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s - -void foo_ptr_to_scalar() { - unsigned long long* a[100]; -} diff --git a/clang/test/utils/update_cc_test_checks/Inputs/annotation-id.expected b/clang/test/utils/update_cc_test_checks/Inputs/annotation-id.expected deleted file mode 100644 index d28469e..0000000 --- a/clang/test/utils/update_cc_test_checks/Inputs/annotation-id.expected +++ /dev/null @@ -1,17 +0,0 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py -// RUN: %clang_cc1 -ftrivial-auto-var-init=zero -triple=x86_64-unknown-linux-gnu -O1 -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s - -// CHECK-LABEL: @foo_ptr_to_scalar( -// CHECK-NEXT: entry: -// CHECK-NEXT: [[A:%.*]] = alloca [100 x i64*], align 16 -// CHECK-NEXT: [[TMP0:%.*]] = bitcast [100 x i64*]* [[A]] to i8* -// CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 800, i8* [[TMP0]]) #[[ATTR3:[0-9]+]] -// CHECK-NEXT: [[TMP1:%.*]] = bitcast [100 x i64*]* [[A]] to i8* -// CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 16 [[TMP1]], i8 0, i64 800, i1 false), !annotation [[ANNT2:![0-9]+]] -// CHECK-NEXT: [[TMP2:%.*]] = bitcast [100 x i64*]* [[A]] to i8* -// CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 800, i8* [[TMP2]]) #[[ATTR3]] -// CHECK-NEXT: ret void -// -void foo_ptr_to_scalar() { - unsigned long long* a[100]; -} diff --git a/clang/test/utils/update_cc_test_checks/Inputs/nosanitize-id.c b/clang/test/utils/update_cc_test_checks/Inputs/nosanitize-id.c deleted file mode 100644 index d136a86..0000000 --- a/clang/test/utils/update_cc_test_checks/Inputs/nosanitize-id.c +++ /dev/null @@ -1,5 +0,0 @@ -// RUN: %clang_cc1 -fsanitize=shift-exponent,shift-base -triple=x86_64-unknown-linux-gnu -O1 -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s - -void foo(int* c, int* shamt) { - *c = 1 << (*c << *shamt); -} diff --git a/clang/test/utils/update_cc_test_checks/Inputs/nosanitize-id.expected b/clang/test/utils/update_cc_test_checks/Inputs/nosanitize-id.expected deleted file mode 100644 index e8e1c74..0000000 --- a/clang/test/utils/update_cc_test_checks/Inputs/nosanitize-id.expected +++ /dev/null @@ -1,55 +0,0 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py -// RUN: %clang_cc1 -fsanitize=shift-exponent,shift-base -triple=x86_64-unknown-linux-gnu -O1 -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s - -// CHECK-LABEL: @foo( -// CHECK-NEXT: entry: -// CHECK-NEXT: [[C_ADDR:%.*]] = alloca i32*, align 8 -// CHECK-NEXT: [[SHAMT_ADDR:%.*]] = alloca i32*, align 8 -// CHECK-NEXT: store i32* [[C:%.*]], i32** [[C_ADDR]], align 8, !tbaa [[TBAA2:![0-9]+]] -// CHECK-NEXT: store i32* [[SHAMT:%.*]], i32** [[SHAMT_ADDR]], align 8, !tbaa [[TBAA2]] -// CHECK-NEXT: [[TMP0:%.*]] = load i32*, i32** [[C_ADDR]], align 8, !tbaa [[TBAA2]] -// CHECK-NEXT: [[TMP1:%.*]] = load i32, i32* [[TMP0]], align 4, !tbaa [[TBAA6:![0-9]+]] -// CHECK-NEXT: [[TMP2:%.*]] = load i32*, i32** [[SHAMT_ADDR]], align 8, !tbaa [[TBAA2]] -// CHECK-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4, !tbaa [[TBAA6]] -// CHECK-NEXT: [[TMP4:%.*]] = icmp ule i32 [[TMP3]], 31, !nosanitize [[NOSAN8:![0-9]+]] -// CHECK-NEXT: br i1 [[TMP4]], label [[CHECK:%.*]], label [[CONT:%.*]], !nosanitize [[NOSAN8]] -// CHECK: check: -// CHECK-NEXT: [[SHL_ZEROS:%.*]] = sub nuw nsw i32 31, [[TMP3]], !nosanitize [[NOSAN8]] -// CHECK-NEXT: [[SHL_CHECK:%.*]] = lshr i32 [[TMP1]], [[SHL_ZEROS]], !nosanitize [[NOSAN8]] -// CHECK-NEXT: [[TMP5:%.*]] = icmp eq i32 [[SHL_CHECK]], 0, !nosanitize [[NOSAN8]] -// CHECK-NEXT: br label [[CONT]], !nosanitize [[NOSAN8]] -// CHECK: cont: -// CHECK-NEXT: [[TMP6:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ [[TMP5]], [[CHECK]] ], !nosanitize [[NOSAN8]] -// CHECK-NEXT: [[TMP7:%.*]] = and i1 [[TMP4]], [[TMP6]], !nosanitize [[NOSAN8]] -// CHECK-NEXT: br i1 [[TMP7]], label [[CONT1:%.*]], label [[HANDLER_SHIFT_OUT_OF_BOUNDS:%.*]], !prof [[PROF9:![0-9]+]], !nosanitize [[NOSAN8]] -// CHECK: handler.shift_out_of_bounds: -// CHECK-NEXT: [[TMP8:%.*]] = zext i32 [[TMP1]] to i64, !nosanitize [[NOSAN8]] -// CHECK-NEXT: [[TMP9:%.*]] = zext i32 [[TMP3]] to i64, !nosanitize [[NOSAN8]] -// CHECK-NEXT: call void @__ubsan_handle_shift_out_of_bounds_abort(i8* bitcast ({ { [124 x i8]*, i32, i32 }, { i16, i16, [6 x i8] }*, { i16, i16, [6 x i8] }* }* @[[GLOB1:[0-9]+]] to i8*), i64 [[TMP8]], i64 [[TMP9]]) #[[ATTR2:[0-9]+]], !nosanitize [[NOSAN8]] -// CHECK-NEXT: unreachable, !nosanitize [[NOSAN8]] -// CHECK: cont1: -// CHECK-NEXT: [[SHL:%.*]] = shl i32 [[TMP1]], [[TMP3]] -// CHECK-NEXT: [[TMP10:%.*]] = icmp ule i32 [[SHL]], 31, !nosanitize [[NOSAN8]] -// CHECK-NEXT: br i1 [[TMP10]], label [[CHECK2:%.*]], label [[CONT5:%.*]], !nosanitize [[NOSAN8]] -// CHECK: check2: -// CHECK-NEXT: [[SHL_ZEROS3:%.*]] = sub nuw nsw i32 31, [[SHL]], !nosanitize [[NOSAN8]] -// CHECK-NEXT: [[SHL_CHECK4:%.*]] = lshr i32 1, [[SHL_ZEROS3]], !nosanitize [[NOSAN8]] -// CHECK-NEXT: [[TMP11:%.*]] = icmp eq i32 [[SHL_CHECK4]], 0, !nosanitize [[NOSAN8]] -// CHECK-NEXT: br label [[CONT5]], !nosanitize [[NOSAN8]] -// CHECK: cont5: -// CHECK-NEXT: [[TMP12:%.*]] = phi i1 [ true, [[CONT1]] ], [ [[TMP11]], [[CHECK2]] ], !nosanitize [[NOSAN8]] -// CHECK-NEXT: [[TMP13:%.*]] = and i1 [[TMP10]], [[TMP12]], !nosanitize [[NOSAN8]] -// CHECK-NEXT: br i1 [[TMP13]], label [[CONT7:%.*]], label [[HANDLER_SHIFT_OUT_OF_BOUNDS6:%.*]], !prof [[PROF9]], !nosanitize [[NOSAN8]] -// CHECK: handler.shift_out_of_bounds6: -// CHECK-NEXT: [[TMP14:%.*]] = zext i32 [[SHL]] to i64, !nosanitize [[NOSAN8]] -// CHECK-NEXT: call void @__ubsan_handle_shift_out_of_bounds_abort(i8* bitcast ({ { [124 x i8]*, i32, i32 }, { i16, i16, [6 x i8] }*, { i16, i16, [6 x i8] }* }* @[[GLOB2:[0-9]+]] to i8*), i64 1, i64 [[TMP14]]) #[[ATTR2]], !nosanitize [[NOSAN8]] -// CHECK-NEXT: unreachable, !nosanitize [[NOSAN8]] -// CHECK: cont7: -// CHECK-NEXT: [[SHL8:%.*]] = shl i32 1, [[SHL]] -// CHECK-NEXT: [[TMP15:%.*]] = load i32*, i32** [[C_ADDR]], align 8, !tbaa [[TBAA2]] -// CHECK-NEXT: store i32 [[SHL8]], i32* [[TMP15]], align 4, !tbaa [[TBAA6]] -// CHECK-NEXT: ret void -// -void foo(int* c, int* shamt) { - *c = 1 << (*c << *shamt); -} diff --git a/clang/test/utils/update_cc_test_checks/Inputs/srcloc-id.c b/clang/test/utils/update_cc_test_checks/Inputs/srcloc-id.c deleted file mode 100644 index aac86db..0000000 --- a/clang/test/utils/update_cc_test_checks/Inputs/srcloc-id.c +++ /dev/null @@ -1,6 +0,0 @@ -// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -O1 -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s -__attribute__((error("oh no"))) void foo(void); - -void bar(void) { - foo(); -} diff --git a/clang/test/utils/update_cc_test_checks/Inputs/srcloc-id.expected b/clang/test/utils/update_cc_test_checks/Inputs/srcloc-id.expected deleted file mode 100644 index a304012..0000000 --- a/clang/test/utils/update_cc_test_checks/Inputs/srcloc-id.expected +++ /dev/null @@ -1,12 +0,0 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py -// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -O1 -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s -__attribute__((error("oh no"))) void foo(void); - -// CHECK-LABEL: @bar( -// CHECK-NEXT: entry: -// CHECK-NEXT: call void @foo(), !srcloc [[SRCLOC2:![0-9]+]] -// CHECK-NEXT: ret void -// -void bar(void) { - foo(); -} diff --git a/clang/test/utils/update_cc_test_checks/Inputs/tbaa-id.c b/clang/test/utils/update_cc_test_checks/Inputs/tbaa-id.c deleted file mode 100644 index 28a111c..0000000 --- a/clang/test/utils/update_cc_test_checks/Inputs/tbaa-id.c +++ /dev/null @@ -1,5 +0,0 @@ -// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -O1 -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s - -void foo(unsigned **ptr) { - *ptr = 0; -} diff --git a/clang/test/utils/update_cc_test_checks/Inputs/tbaa-id.expected b/clang/test/utils/update_cc_test_checks/Inputs/tbaa-id.expected deleted file mode 100644 index 0eb4fc4..0000000 --- a/clang/test/utils/update_cc_test_checks/Inputs/tbaa-id.expected +++ /dev/null @@ -1,14 +0,0 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py -// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -O1 -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s - -// CHECK-LABEL: @foo( -// CHECK-NEXT: entry: -// CHECK-NEXT: [[PTR_ADDR:%.*]] = alloca i32**, align 8 -// CHECK-NEXT: store i32** [[PTR:%.*]], i32*** [[PTR_ADDR]], align 8, !tbaa [[TBAA2:![0-9]+]] -// CHECK-NEXT: [[TMP0:%.*]] = load i32**, i32*** [[PTR_ADDR]], align 8, !tbaa [[TBAA2]] -// CHECK-NEXT: store i32* null, i32** [[TMP0]], align 8, !tbaa [[TBAA2]] -// CHECK-NEXT: ret void -// -void foo(unsigned **ptr) { - *ptr = 0; -} diff --git a/clang/test/utils/update_cc_test_checks/Inputs/tbaa-struct-id.c b/clang/test/utils/update_cc_test_checks/Inputs/tbaa-struct-id.c deleted file mode 100644 index c3043ff..0000000 --- a/clang/test/utils/update_cc_test_checks/Inputs/tbaa-struct-id.c +++ /dev/null @@ -1,25 +0,0 @@ -// RUN: %clang_cc1 -flegacy-pass-manager -triple arm64-apple-iphoneos -Oz -mllvm -enable-constraint-elimination=true -fpass-by-value-is-noalias -emit-llvm -o - %s | FileCheck %s - -typedef struct { - void *a; - void *b; - void *c; - void *d; - void *e; -} Foo; - -static void bar(Foo f) { - if (f.b) - __builtin_trap(); -} - -static int baz(Foo f) { - bar(f); - return *(int *)f.a; -} - -int barbar(Foo arg) { - int a, b; - a = baz(arg); - return a - b; -} diff --git a/clang/test/utils/update_cc_test_checks/Inputs/tbaa-struct-id.expected b/clang/test/utils/update_cc_test_checks/Inputs/tbaa-struct-id.expected deleted file mode 100644 index aa4106d..0000000 --- a/clang/test/utils/update_cc_test_checks/Inputs/tbaa-struct-id.expected +++ /dev/null @@ -1,38 +0,0 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py -// RUN: %clang_cc1 -flegacy-pass-manager -triple arm64-apple-iphoneos -Oz -mllvm -enable-constraint-elimination=true -fpass-by-value-is-noalias -emit-llvm -o - %s | FileCheck %s - -typedef struct { - void *a; - void *b; - void *c; - void *d; - void *e; -} Foo; - -static void bar(Foo f) { - if (f.b) - __builtin_trap(); -} - -static int baz(Foo f) { - bar(f); - return *(int *)f.a; -} - -// CHECK-LABEL: @barbar( -// CHECK-NEXT: entry: -// CHECK-NEXT: [[BYVAL_TEMP_SROA_3_0__SROA_IDX4:%.*]] = getelementptr inbounds [[STRUCT_FOO:%.*]], %struct.Foo* [[ARG:%.*]], i64 0, i32 1 -// CHECK-NEXT: [[BYVAL_TEMP_SROA_3_0_COPYLOAD:%.*]] = load i8*, i8** [[BYVAL_TEMP_SROA_3_0__SROA_IDX4]], align 8, !tbaa.struct [[TBAAST6:![0-9]+]] -// CHECK-NEXT: [[TOBOOL_NOT_I_I:%.*]] = icmp eq i8* [[BYVAL_TEMP_SROA_3_0_COPYLOAD]], null -// CHECK-NEXT: br i1 [[TOBOOL_NOT_I_I]], label [[BAZ_EXIT:%.*]], label [[IF_THEN_I_I:%.*]] -// CHECK: if.then.i.i: -// CHECK-NEXT: tail call void @llvm.trap() #[[ATTR2:[0-9]+]], !noalias !11 -// CHECK-NEXT: unreachable -// CHECK: baz.exit: -// CHECK-NEXT: ret i32 undef -// -int barbar(Foo arg) { - int a, b; - a = baz(arg); - return a - b; -} diff --git a/clang/test/utils/update_cc_test_checks/annotation-id.test b/clang/test/utils/update_cc_test_checks/annotation-id.test deleted file mode 100644 index b3c3d4e..0000000 --- a/clang/test/utils/update_cc_test_checks/annotation-id.test +++ /dev/null @@ -1,7 +0,0 @@ -## Test that CHECK lines are generated before the definion and not the declaration - -# RUN: cp %S/Inputs/annotation-id.c %t.c && %update_cc_test_checks %t.c -# RUN: diff -u %S/Inputs/annotation-id.expected %t.c -## Check that re-running update_cc_test_checks doesn't change the output -# RUN: %update_cc_test_checks %t.c -# RUN: diff -u %S/Inputs/annotation-id.expected %t.c diff --git a/clang/test/utils/update_cc_test_checks/nosanitize-id.test b/clang/test/utils/update_cc_test_checks/nosanitize-id.test deleted file mode 100644 index c486534..0000000 --- a/clang/test/utils/update_cc_test_checks/nosanitize-id.test +++ /dev/null @@ -1,7 +0,0 @@ -## Test that CHECK lines are generated before the definion and not the declaration - -# RUN: cp %S/Inputs/nosanitize-id.c %t.c && %update_cc_test_checks %t.c -# RUN: diff -u %S/Inputs/nosanitize-id.expected %t.c -## Check that re-running update_cc_test_checks doesn't change the output -# RUN: %update_cc_test_checks %t.c -# RUN: diff -u %S/Inputs/nosanitize-id.expected %t.c diff --git a/clang/test/utils/update_cc_test_checks/srcloc-id.test b/clang/test/utils/update_cc_test_checks/srcloc-id.test deleted file mode 100644 index 0bdc25c..0000000 --- a/clang/test/utils/update_cc_test_checks/srcloc-id.test +++ /dev/null @@ -1,7 +0,0 @@ -## Test that CHECK lines are generated before the definion and not the declaration - -# RUN: cp %S/Inputs/srcloc-id.c %t.c && %update_cc_test_checks %t.c -# RUN: diff -u %S/Inputs/srcloc-id.expected %t.c -## Check that re-running update_cc_test_checks doesn't change the output -# RUN: %update_cc_test_checks %t.c -# RUN: diff -u %S/Inputs/srcloc-id.expected %t.c diff --git a/clang/test/utils/update_cc_test_checks/tbaa-id.test b/clang/test/utils/update_cc_test_checks/tbaa-id.test deleted file mode 100644 index 7f9efa3..0000000 --- a/clang/test/utils/update_cc_test_checks/tbaa-id.test +++ /dev/null @@ -1,7 +0,0 @@ -## Test that CHECK lines are generated before the definion and not the declaration - -# RUN: cp %S/Inputs/tbaa-id.c %t.c && %update_cc_test_checks %t.c -# RUN: diff -u %S/Inputs/tbaa-id.expected %t.c -## Check that re-running update_cc_test_checks doesn't change the output -# RUN: %update_cc_test_checks %t.c -# RUN: diff -u %S/Inputs/tbaa-id.expected %t.c diff --git a/clang/test/utils/update_cc_test_checks/tbaa-struct-id.test b/clang/test/utils/update_cc_test_checks/tbaa-struct-id.test deleted file mode 100644 index 802f74b..0000000 --- a/clang/test/utils/update_cc_test_checks/tbaa-struct-id.test +++ /dev/null @@ -1,7 +0,0 @@ -## Test that CHECK lines are generated before the definion and not the declaration - -# RUN: cp %S/Inputs/tbaa-struct-id.c %t.c && %update_cc_test_checks %t.c -# RUN: diff -u %S/Inputs/tbaa-struct-id.expected %t.c -## Check that re-running update_cc_test_checks doesn't change the output -# RUN: %update_cc_test_checks %t.c -# RUN: diff -u %S/Inputs/tbaa-struct-id.expected %t.c diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py index 5c16ff6..e5db6fb 100644 --- a/llvm/utils/UpdateTestChecks/common.py +++ b/llvm/utils/UpdateTestChecks/common.py @@ -616,15 +616,11 @@ nameless_values = [ NamelessValue(r'GLOB' , '@' , None , r'@' , r'[a-zA-Z0-9_$"\\.-]+' , None , r'.+' , True) , NamelessValue(r'DBG' , '!' , r'!dbg ' , None , None , r'![0-9]+' , None , False) , NamelessValue(r'PROF' , '!' , r'!prof ' , None , None , r'![0-9]+' , None , False) , + NamelessValue(r'TBAA' , '!' , r'!tbaa ' , None , None , r'![0-9]+' , None , False) , NamelessValue(r'RNG' , '!' , r'!range ' , None , None , r'![0-9]+' , None , False) , NamelessValue(r'LOOP' , '!' , r'!llvm.loop ' , None , None , r'![0-9]+' , None , False) , NamelessValue(r'META' , '!' , r'metadata ' , None , None , r'![0-9]+' , None , False) , NamelessValue(r'META' , '!' , None , r'' , r'![0-9]+' , None , r'(?:distinct |)!.*' , False) , - NamelessValue(r'TBAA' , '!' , r'!tbaa ' , None , None , r'![0-9]+' , None , False) , - NamelessValue(r'TBAAST' , '!' , r'!tbaa.struct ', None , None , r'![0-9]+' , None , False) , - NamelessValue(r'ANNT' , '!' , r'!annotation ' , None , None , r'![0-9]+' , None , False) , - NamelessValue(r'SRCLOC' , '!' , r'!srcloc ' , None , None , r'![0-9]+' , None , False) , - NamelessValue(r'NOSAN' , '!' , r'!nosanitize ' , None , None , r'![0-9]+' , None , False) , ] def createOrRegexp(old, new):