Skip to content

Commit

Permalink
[Clang] Convert some tests to opaque pointers (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Jun 8, 2023
1 parent 9b9848f commit d3d5cdb
Show file tree
Hide file tree
Showing 8 changed files with 274 additions and 301 deletions.
27 changes: 13 additions & 14 deletions clang/test/CodeGenCXX/PR24289.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -no-opaque-pointers -emit-llvm %s -o - -triple=x86_64-pc-linux-gnu -std=c++11 | FileCheck %s
// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-linux-gnu -std=c++11 | FileCheck %s

namespace std {
template <class T>
Expand All @@ -24,8 +24,7 @@ void f() {
{0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}};
}

// CHECK-DAG: @_ZZ1fvE1a = internal global %{{.*}} { %{{.*}}* getelementptr inbounds ([14 x %{{.*}}], [14 x %{{.*}}]
// CHECK-DAG: * @_ZGRZ1fvE1a_, i32 0, i32 0), i64 14 }
// CHECK-DAG: @_ZZ1fvE1a = internal global %{{.*}} { ptr @_ZGRZ1fvE1a_, i64 14 }
// CHECK-DAG: @_ZGRZ1fvE1a0_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1a1_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1a2_ = internal constant [1 x i32] zeroinitializer
Expand All @@ -40,16 +39,16 @@ void f() {
// CHECK-DAG: @_ZGRZ1fvE1aB_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1aC_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1aD_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1a_ = internal constant [14 x %{{.*}}] [%{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1a0_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1a1_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1a2_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1a3_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1a4_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1a5_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1a6_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1a7_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1a8_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1a9_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1aA_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1aB_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1aC_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1aD_, i32 0, i32 0), i64 1 }]
// CHECK-DAG: @_ZZ1fvE1b = internal global %{{.*}} { %{{.*}}* getelementptr inbounds ([4 x %{{.*}}], [4 x %{{.*}}]*
// CHECK-DAG: @_ZGRZ1fvE1b_, i32 0, i32 0), i64 4 }
// CHECK-DAG: @_ZGRZ1fvE1a_ = internal constant [14 x %{{.*}}] [%{{.*}} { ptr @_ZGRZ1fvE1a0_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1a1_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1a2_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1a3_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1a4_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1a5_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1a6_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1a7_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1a8_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1a9_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1aA_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1aB_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1aC_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1aD_, i64 1 }]
// CHECK-DAG: @_ZZ1fvE1b = internal global %{{.*}} { ptr
// CHECK-DAG: @_ZGRZ1fvE1b_, i64 4 }
// CHECK-DAG: @_ZGRZ1fvE1b0_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1b1_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1b2_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1b3_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1b_ = internal constant [4 x %{{.*}}] [%{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1b0_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1b1_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1b2_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1b3_, i32 0, i32 0), i64 1 }]
// CHECK-DAG: @_ZZ1fvE1c = internal global %{{.*}} { %{{.*}}* getelementptr inbounds ([9 x %{{.*}}], [9 x %{{.*}}]*
// CHECK-DAG: @_ZGRZ1fvE1c_, i32 0, i32 0), i64 9 }
// CHECK-DAG: @_ZGRZ1fvE1b_ = internal constant [4 x %{{.*}}] [%{{.*}} { ptr @_ZGRZ1fvE1b0_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1b1_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1b2_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1b3_, i64 1 }]
// CHECK-DAG: @_ZZ1fvE1c = internal global %{{.*}} { ptr
// CHECK-DAG: @_ZGRZ1fvE1c_, i64 9 }
// CHECK-DAG: @_ZGRZ1fvE1c0_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1c1_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1c2_ = internal constant [1 x i32] zeroinitializer
Expand All @@ -59,15 +58,15 @@ void f() {
// CHECK-DAG: @_ZGRZ1fvE1c6_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1c7_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1c8_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1c_ = internal constant [9 x %{{.*}}] [%{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1c0_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1c1_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1c2_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1c3_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1c4_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1c5_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1c6_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1c7_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1c8_, i32 0, i32 0), i64 1 }]
// CHECK-DAG: @_ZZ1fvE1d = internal global %{{.*}} { %{{.*}}* getelementptr inbounds ([5 x %{{.*}}], [5 x %{{.*}}]* @_ZGRZ1fvE1d_, i32 0, i32 0), i64 5 }
// CHECK-DAG: @_ZGRZ1fvE1c_ = internal constant [9 x %{{.*}}] [%{{.*}} { ptr @_ZGRZ1fvE1c0_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1c1_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1c2_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1c3_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1c4_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1c5_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1c6_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1c7_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1c8_, i64 1 }]
// CHECK-DAG: @_ZZ1fvE1d = internal global %{{.*}} { ptr @_ZGRZ1fvE1d_, i64 5 }
// CHECK-DAG: @_ZGRZ1fvE1d0_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1d1_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1d2_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1d3_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1d4_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1d_ = internal constant [5 x %{{.*}}] [%{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1d0_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1d1_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1d2_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1d3_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1d4_, i32 0, i32 0), i64 1 }]
// CHECK-DAG: @_ZZ1fvE1e = internal global %{{.*}} { %{{.*}}* getelementptr inbounds ([11 x %{{.*}}], [11 x %{{.*}}]* @_ZGRZ1fvE1e_, i32 0, i32 0), i64 11 }
// CHECK-DAG: @_ZGRZ1fvE1d_ = internal constant [5 x %{{.*}}] [%{{.*}} { ptr @_ZGRZ1fvE1d0_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1d1_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1d2_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1d3_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1d4_, i64 1 }]
// CHECK-DAG: @_ZZ1fvE1e = internal global %{{.*}} { ptr @_ZGRZ1fvE1e_, i64 11 }
// CHECK-DAG: @_ZGRZ1fvE1e0_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1e1_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1e2_ = internal constant [1 x i32] zeroinitializer
Expand All @@ -79,4 +78,4 @@ void f() {
// CHECK-DAG: @_ZGRZ1fvE1e8_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1e9_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1eA_ = internal constant [1 x i32] zeroinitializer
// CHECK-DAG: @_ZGRZ1fvE1e_ = internal constant [11 x %{{.*}}] [%{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1e0_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1e1_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1e2_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1e3_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1e4_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1e5_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1e6_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1e7_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1e8_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1e9_, i32 0, i32 0), i64 1 }, %{{.*}} { i32* getelementptr inbounds ([1 x i32], [1 x i32]* @_ZGRZ1fvE1eA_, i32 0, i32 0), i64 1 }]
// CHECK-DAG: @_ZGRZ1fvE1e_ = internal constant [11 x %{{.*}}] [%{{.*}} { ptr @_ZGRZ1fvE1e0_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1e1_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1e2_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1e3_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1e4_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1e5_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1e6_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1e7_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1e8_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1e9_, i64 1 }, %{{.*}} { ptr @_ZGRZ1fvE1eA_, i64 1 }]
10 changes: 4 additions & 6 deletions clang/test/CodeGenCXX/arm-vaarg.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -no-opaque-pointers -triple armv7-apple-ios -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -triple armv7-apple-ios -emit-llvm -o - %s | FileCheck %s
struct Empty {};

Empty emptyvar;
Expand All @@ -9,18 +9,16 @@ int take_args(int a, ...) {
// CHECK: call void @llvm.va_start

emptyvar = __builtin_va_arg(l, Empty);
// CHECK: load i8*, i8**
// CHECK-NOT: getelementptr
// CHECK: [[EMPTY_PTR:%[a-zA-Z0-9._]+]] = bitcast i8* {{%[a-zA-Z0-9._]+}} to %struct.Empty*
// CHECK: load ptr, ptr

// It's conceivable that EMPTY_PTR may not actually be a valid pointer
// (e.g. it's at the very bottom of the stack and the next page is
// invalid). This doesn't matter provided it's never loaded (there's no
// well-defined way to tell), but it becomes a problem if we do try to use it.
// CHECK-NOT: load %struct.Empty, %struct.Empty* [[EMPTY_PTR]]
// CHECK-NOT: load %struct.Empty, ptr {{%[a-zA-Z0-9._]+}}

int i = __builtin_va_arg(l, int);
// CHECK: load i32, i32*
// CHECK: load i32, ptr

__builtin_va_end(l);
return i;
Expand Down

0 comments on commit d3d5cdb

Please sign in to comment.