[llvm] 2e0a829 - [MetaRenamer] Convert tests to opaque pointers (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 4 08:03:24 PST 2023
Author: Nikita Popov
Date: 2023-01-04T17:03:10+01:00
New Revision: 2e0a829da880db00e7e6b49cf50e95792dfb2be8
URL: https://github.com/llvm/llvm-project/commit/2e0a829da880db00e7e6b49cf50e95792dfb2be8
DIFF: https://github.com/llvm/llvm-project/commit/2e0a829da880db00e7e6b49cf50e95792dfb2be8.diff
LOG: [MetaRenamer] Convert tests to opaque pointers (NFC)
Added:
Modified:
llvm/test/Transforms/MetaRenamer/exclude-names.ll
llvm/test/Transforms/MetaRenamer/metarenamer.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/MetaRenamer/exclude-names.ll b/llvm/test/Transforms/MetaRenamer/exclude-names.ll
index 2c7b8198432d5..6e088ef7f4190 100644
--- a/llvm/test/Transforms/MetaRenamer/exclude-names.ll
+++ b/llvm/test/Transforms/MetaRenamer/exclude-names.ll
@@ -2,15 +2,15 @@
; Check that excluded names don't get renamed while all the other ones do
-; CHECK: %my_struct1 = type { i8*, i32 }
-; CHECK: %my_struct2 = type { i8*, i32 }
-; CHECK-NOT: %other_struct = type { i8*, i32 }
+; CHECK: %my_struct1 = type { ptr, i32 }
+; CHECK: %my_struct2 = type { ptr, i32 }
+; CHECK-NOT: %other_struct = type { ptr, i32 }
; CHECK: @my_global1 = global i32 42
; CHECK: @my_global2 = global i32 24
; CHECK-NOT: @other_global = global i32 24
-; CHECK: @my_alias1 = alias i32, i32* @my_global1
-; CHECK: @my_alias2 = alias i32, i32* @my_global2
-; CHECK-NOT: @other_alias = alias i32, i32* @other_global
+; CHECK: @my_alias1 = alias i32, ptr @my_global1
+; CHECK: @my_alias2 = alias i32, ptr @my_global2
+; CHECK-NOT: @other_alias = alias i32, ptr @other_global
; CHECK: declare void @my_func1
; CHECK: declare void @my_func2
; CHECK-NOT: declare void @other_func
@@ -18,25 +18,25 @@
; CHECK: call void @my_func1
; CHECK: call void @my_func2
; CHECK-NOT: call void @other_func
-; CHECK: load i32, i32* @my_global1
-; CHECK: load i32, i32* @my_global2
-; CHECK-NOT: load i32, i32* @other_global
-; CHECK: load i32, i32* @my_alias1
-; CHECK: load i32, i32* @my_alias2
-; CHECK-NOT: load i32, i32* @other_alias
+; CHECK: load i32, ptr @my_global1
+; CHECK: load i32, ptr @my_global2
+; CHECK-NOT: load i32, ptr @other_global
+; CHECK: load i32, ptr @my_alias1
+; CHECK: load i32, ptr @my_alias2
+; CHECK-NOT: load i32, ptr @other_alias
; CHECK: alloca %my_struct1
; CHECK: alloca %my_struct2
; CHECK-NOT: alloca %other_struct
-%my_struct1 = type { i8*, i32 }
-%my_struct2 = type { i8*, i32 }
-%other_struct = type { i8*, i32 }
+%my_struct1 = type { ptr, i32 }
+%my_struct2 = type { ptr, i32 }
+%other_struct = type { ptr, i32 }
@my_global1 = global i32 42
@my_global2 = global i32 24
@other_global = global i32 24
- at my_alias1 = alias i32, i32* @my_global1
- at my_alias2 = alias i32, i32* @my_global2
- at other_alias = alias i32, i32* @other_global
+ at my_alias1 = alias i32, ptr @my_global1
+ at my_alias2 = alias i32, ptr @my_global2
+ at other_alias = alias i32, ptr @other_global
declare void @my_func1()
declare void @my_func2()
declare void @other_func()
@@ -45,12 +45,12 @@ define void @some_func() {
call void @my_func1()
call void @my_func2()
call void @other_func()
- %a = load i32, i32* @my_global1
- %b = load i32, i32* @my_global2
- %c = load i32, i32* @other_global
- %d = load i32, i32* @my_alias1
- %e = load i32, i32* @my_alias2
- %f = load i32, i32* @other_alias
+ %a = load i32, ptr @my_global1
+ %b = load i32, ptr @my_global2
+ %c = load i32, ptr @other_global
+ %d = load i32, ptr @my_alias1
+ %e = load i32, ptr @my_alias2
+ %f = load i32, ptr @other_alias
%g = alloca %my_struct1
%h = alloca %my_struct2
%i = alloca %other_struct
diff --git a/llvm/test/Transforms/MetaRenamer/metarenamer.ll b/llvm/test/Transforms/MetaRenamer/metarenamer.ll
index 8dbecad42fe82..042e6961355ae 100644
--- a/llvm/test/Transforms/MetaRenamer/metarenamer.ll
+++ b/llvm/test/Transforms/MetaRenamer/metarenamer.ll
@@ -12,7 +12,7 @@ target triple = "x86_64-pc-linux-gnu"
@func_5_xxx.static_local_3_xxx = internal global i32 3, align 4
@global_3_xxx = common global i32 0, align 4
- at func_7_xxx = weak alias i32 (...), i32 (...)* @aliased_func_7_xxx
+ at func_7_xxx = weak alias i32 (...), ptr @aliased_func_7_xxx
define i32 @aliased_func_7_xxx(...) {
ret i32 0
@@ -22,24 +22,20 @@ define i32 @func_3_xxx() nounwind uwtable ssp {
ret i32 3
}
-define void @func_4_xxx(%struct.foo_xxx* sret(%struct.foo_xxx) %agg.result) nounwind uwtable ssp {
+define void @func_4_xxx(ptr sret(%struct.foo_xxx) %agg.result) nounwind uwtable ssp {
%1 = alloca %struct.foo_xxx, align 8
- %2 = getelementptr inbounds %struct.foo_xxx, %struct.foo_xxx* %1, i32 0, i32 0
- store i32 1, i32* %2, align 4
- %3 = getelementptr inbounds %struct.foo_xxx, %struct.foo_xxx* %1, i32 0, i32 1
- store float 2.000000e+00, float* %3, align 4
- %4 = getelementptr inbounds %struct.foo_xxx, %struct.foo_xxx* %1, i32 0, i32 2
- %5 = getelementptr inbounds %struct.bar_xxx, %struct.bar_xxx* %4, i32 0, i32 0
- store i32 3, i32* %5, align 4
- %6 = getelementptr inbounds %struct.bar_xxx, %struct.bar_xxx* %4, i32 0, i32 1
- store double 4.000000e+00, double* %6, align 8
- %7 = bitcast %struct.foo_xxx* %agg.result to i8*
- %8 = bitcast %struct.foo_xxx* %1 to i8*
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %7, i8* align 8 %8, i64 24, i1 false)
+ store i32 1, ptr %1, align 4
+ %2 = getelementptr inbounds %struct.foo_xxx, ptr %1, i32 0, i32 1
+ store float 2.000000e+00, ptr %2, align 4
+ %3 = getelementptr inbounds %struct.foo_xxx, ptr %1, i32 0, i32 2
+ store i32 3, ptr %3, align 4
+ %4 = getelementptr inbounds %struct.bar_xxx, ptr %3, i32 0, i32 1
+ store double 4.000000e+00, ptr %4, align 8
+ call void @llvm.memcpy.p0.p0.i64(ptr align 8 %agg.result, ptr align 8 %1, i64 24, i1 false)
ret void
}
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) nounwind
+declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture, i64, i1) nounwind
define i32 @func_5_xxx(i32 %arg_1_xxx, i32 %arg_2_xxx, i32 %arg_3_xxx, i32 %arg_4_xxx) nounwind uwtable ssp {
%1 = alloca i32, align 4
@@ -49,17 +45,17 @@ define i32 @func_5_xxx(i32 %arg_1_xxx, i32 %arg_2_xxx, i32 %arg_3_xxx, i32 %arg_
%local_1_xxx = alloca i32, align 4
%local_2_xxx = alloca i32, align 4
%i = alloca i32, align 4
- store i32 %arg_1_xxx, i32* %1, align 4
- store i32 %arg_2_xxx, i32* %2, align 4
- store i32 %arg_3_xxx, i32* %3, align 4
- store i32 %arg_4_xxx, i32* %4, align 4
- store i32 1, i32* %local_1_xxx, align 4
- store i32 2, i32* %local_2_xxx, align 4
- store i32 0, i32* %i, align 4
+ store i32 %arg_1_xxx, ptr %1, align 4
+ store i32 %arg_2_xxx, ptr %2, align 4
+ store i32 %arg_3_xxx, ptr %3, align 4
+ store i32 %arg_4_xxx, ptr %4, align 4
+ store i32 1, ptr %local_1_xxx, align 4
+ store i32 2, ptr %local_2_xxx, align 4
+ store i32 0, ptr %i, align 4
br label %5
; <label>:5 ; preds = %9, %0
- %6 = load i32, i32* %i, align 4
+ %6 = load i32, ptr %i, align 4
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %12
@@ -67,24 +63,24 @@ define i32 @func_5_xxx(i32 %arg_1_xxx, i32 %arg_2_xxx, i32 %arg_3_xxx, i32 %arg_
br label %9
; <label>:9 ; preds = %8
- %10 = load i32, i32* %i, align 4
+ %10 = load i32, ptr %i, align 4
%11 = add nsw i32 %10, 1
- store i32 %11, i32* %i, align 4
+ store i32 %11, ptr %i, align 4
br label %5
; <label>:12 ; preds = %5
- %13 = load i32, i32* %local_1_xxx, align 4
- %14 = load i32, i32* %1, align 4
+ %13 = load i32, ptr %local_1_xxx, align 4
+ %14 = load i32, ptr %1, align 4
%15 = add nsw i32 %13, %14
- %16 = load i32, i32* %local_2_xxx, align 4
+ %16 = load i32, ptr %local_2_xxx, align 4
%17 = add nsw i32 %15, %16
- %18 = load i32, i32* %2, align 4
+ %18 = load i32, ptr %2, align 4
%19 = add nsw i32 %17, %18
- %20 = load i32, i32* @func_5_xxx.static_local_3_xxx, align 4
+ %20 = load i32, ptr @func_5_xxx.static_local_3_xxx, align 4
%21 = add nsw i32 %19, %20
- %22 = load i32, i32* %3, align 4
+ %22 = load i32, ptr %3, align 4
%23 = add nsw i32 %21, %22
- %24 = load i32, i32* %4, align 4
+ %24 = load i32, ptr %4, align 4
%25 = add nsw i32 %23, %24
ret i32 %25
}
@@ -92,22 +88,22 @@ define i32 @func_5_xxx(i32 %arg_1_xxx, i32 %arg_2_xxx, i32 %arg_3_xxx, i32 %arg_
define i32 @varargs_func_6_xxx(i32 %arg_1_xxx, i32 %arg_2_xxx, ...) nounwind uwtable ssp {
%1 = alloca i32, align 4
%2 = alloca i32, align 4
- store i32 %arg_1_xxx, i32* %1, align 4
- store i32 %arg_2_xxx, i32* %2, align 4
+ store i32 %arg_1_xxx, ptr %1, align 4
+ store i32 %arg_2_xxx, ptr %2, align 4
ret i32 6
}
-declare noalias i8* @malloc(i64)
-declare void @free(i8* nocapture)
+declare noalias ptr @malloc(i64)
+declare void @free(ptr nocapture)
define void @dont_rename_lib_funcs() {
; CHECK-LABEL: @foo(
; CHECK-NEXT: bb:
-; CHECK-NEXT: [[TMP:%.*]] = call i8* @malloc(i64 23)
-; CHECK-NEXT: call void @free(i8* [[TMP]])
+; CHECK-NEXT: [[TMP:%.*]] = call ptr @malloc(i64 23)
+; CHECK-NEXT: call void @free(ptr [[TMP]])
; CHECK-NEXT: ret void
;
- %x = call i8* @malloc(i64 23)
- call void @free(i8* %x)
+ %x = call ptr @malloc(i64 23)
+ call void @free(ptr %x)
ret void
}
More information about the llvm-commits
mailing list