diff options
author | Tom Stellard <tstellar@redhat.com> | 2023-01-26 14:55:55 -0800 |
---|---|---|
committer | Tom Stellard <tstellar@redhat.com> | 2023-01-27 21:44:11 -0800 |
commit | 124f90bd89b97066e01274a9bba1068f3a175d66 (patch) | |
tree | 6fe1c939589de2de123a31cb210592574b7e2a6e | |
parent | c0e53ac3c3da7cda6af3b0f056cc8174c3bae44c (diff) | |
download | llvm-124f90bd89b97066e01274a9bba1068f3a175d66.zip llvm-124f90bd89b97066e01274a9bba1068f3a175d66.tar.gz llvm-124f90bd89b97066e01274a9bba1068f3a175d66.tar.bz2 |
Revert "Verifier: Disallow uses of intrinsic global variables"llvmorg-16.0.0-rc1
This reverts commit b67c16ff6af557174e498d6d82df9936e333f3d6.
-rw-r--r-- | llvm/lib/IR/Verifier.cpp | 6 | ||||
-rw-r--r-- | llvm/test/Linker/Inputs/funcimport_appending_global_used.ll | 6 | ||||
-rw-r--r-- | llvm/test/Linker/funcimport_appending_global_used.ll | 22 | ||||
-rw-r--r-- | llvm/test/Verifier/global-ctors-dtors-uses.ll | 16 | ||||
-rw-r--r-- | llvm/test/Verifier/used-uses.ll | 20 |
5 files changed, 0 insertions, 70 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index 83e42bc..2d62d31 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -730,9 +730,6 @@ void Verifier::visitGlobalVariable(const GlobalVariable &GV) { GV.getName() == "llvm.global_dtors")) { Check(!GV.hasInitializer() || GV.hasAppendingLinkage(), "invalid linkage for intrinsic global variable", &GV); - Check(GV.materialized_use_empty(), - "invalid uses of intrinsic global variable", &GV); - // Don't worry about emitting an error for it not being an array, // visitGlobalValue will complain on appending non-array. if (ArrayType *ATy = dyn_cast<ArrayType>(GV.getValueType())) { @@ -759,9 +756,6 @@ void Verifier::visitGlobalVariable(const GlobalVariable &GV) { GV.getName() == "llvm.compiler.used")) { Check(!GV.hasInitializer() || GV.hasAppendingLinkage(), "invalid linkage for intrinsic global variable", &GV); - Check(GV.materialized_use_empty(), - "invalid uses of intrinsic global variable", &GV); - Type *GVType = GV.getValueType(); if (ArrayType *ATy = dyn_cast<ArrayType>(GVType)) { PointerType *PTy = dyn_cast<PointerType>(ATy->getElementType()); diff --git a/llvm/test/Linker/Inputs/funcimport_appending_global_used.ll b/llvm/test/Linker/Inputs/funcimport_appending_global_used.ll deleted file mode 100644 index 5783c0a..0000000 --- a/llvm/test/Linker/Inputs/funcimport_appending_global_used.ll +++ /dev/null @@ -1,6 +0,0 @@ -@v = weak global i8 1 -@llvm.used = appending global [2 x ptr] [ptr @foo, ptr @v] - -define void @foo() { - ret void -} diff --git a/llvm/test/Linker/funcimport_appending_global_used.ll b/llvm/test/Linker/funcimport_appending_global_used.ll deleted file mode 100644 index b54e6ea..0000000 --- a/llvm/test/Linker/funcimport_appending_global_used.ll +++ /dev/null @@ -1,22 +0,0 @@ -; RUN: opt -module-summary %s -o %t.bc -; RUN: opt -module-summary %p/Inputs/funcimport_appending_global_used.ll -o %t2.bc -; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc - -; Do the import now -; RUN: llvm-link %t.bc -summary-index=%t3.thinlto.bc -import=foo:%t2.bc -S | FileCheck %s - -; Test case where the verifier would fail if checking use_empty -; instead of materialized_use_empty on llvm.used. - -; CHECK: @llvm.used = appending global [1 x ptr] [ptr @f] - -declare void @f() -@llvm.used = appending global [1 x ptr] [ptr @f] - -define i32 @main() { -entry: - call void @foo() - ret i32 0 -} - -declare void @foo() diff --git a/llvm/test/Verifier/global-ctors-dtors-uses.ll b/llvm/test/Verifier/global-ctors-dtors-uses.ll deleted file mode 100644 index 1af4fb7..0000000 --- a/llvm/test/Verifier/global-ctors-dtors-uses.ll +++ /dev/null @@ -1,16 +0,0 @@ -; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s - -; CHECK: invalid uses of intrinsic global variable -; CHECK-NEXT: ptr @llvm.global_ctors -@llvm.global_ctors = appending global [1 x { i32, ptr, ptr } ] [ - { i32, ptr, ptr } { i32 65535, ptr null, ptr null } -] - -; CHECK: invalid uses of intrinsic global variable -; CHECK-NEXT: ptr @llvm.global_dtors -@llvm.global_dtors = appending global [1 x { i32, ptr, ptr } ] [ - { i32, ptr, ptr } { i32 65535, ptr null, ptr null } -] - -@ctor_user = global ptr @llvm.global_ctors -@dtor_user = global ptr @llvm.global_dtors diff --git a/llvm/test/Verifier/used-uses.ll b/llvm/test/Verifier/used-uses.ll deleted file mode 100644 index 2dda638..0000000 --- a/llvm/test/Verifier/used-uses.ll +++ /dev/null @@ -1,20 +0,0 @@ -; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s - -; CHECK: invalid uses of intrinsic global variable -; CHECK-NEXT: ptr @llvm.used -@llvm.used = appending global [1 x ptr] [ptr @foo] - -; CHECK: invalid uses of intrinsic global variable -; CHECK-NEXT: ptr @llvm.compiler.used -@llvm.compiler.used = appending global [1 x ptr] [ptr @bar] - -define void @foo() { - ret void -} - -define void @bar() { - ret void -} - -@used_user = global ptr @llvm.used -@compiler_used_user = global ptr @llvm.compiler.used |