[llvm-branch-commits] [llvm] 124f90b - Revert "Verifier: Disallow uses of intrinsic global variables"

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jan 27 21:46:05 PST 2023


Author: Tom Stellard
Date: 2023-01-27T21:44:11-08:00
New Revision: 124f90bd89b97066e01274a9bba1068f3a175d66

URL: https://github.com/llvm/llvm-project/commit/124f90bd89b97066e01274a9bba1068f3a175d66
DIFF: https://github.com/llvm/llvm-project/commit/124f90bd89b97066e01274a9bba1068f3a175d66.diff

LOG: Revert "Verifier: Disallow uses of intrinsic global variables"

This reverts commit b67c16ff6af557174e498d6d82df9936e333f3d6.

Added: 
    

Modified: 
    llvm/lib/IR/Verifier.cpp

Removed: 
    llvm/test/Linker/Inputs/funcimport_appending_global_used.ll
    llvm/test/Linker/funcimport_appending_global_used.ll
    llvm/test/Verifier/global-ctors-dtors-uses.ll
    llvm/test/Verifier/used-uses.ll


################################################################################
diff  --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 83e42bc184ff2..2d62d31cf6b47 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 5783c0a3ef1ca..0000000000000
--- a/llvm/test/Linker/Inputs/funcimport_appending_global_used.ll
+++ /dev/null
@@ -1,6 +0,0 @@
- at v = weak global i8 1
- at 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 b54e6ea71fa7c..0000000000000
--- 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()
- at 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 1af4fb7ca9c0e..0000000000000
--- 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
- at 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
- at llvm.global_dtors = appending global [1 x { i32, ptr, ptr } ] [
-  { i32, ptr, ptr } { i32 65535, ptr null, ptr null }
-]
-
- at ctor_user = global ptr @llvm.global_ctors
- at 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 2dda638021e18..0000000000000
--- 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
- at llvm.used = appending global [1 x ptr] [ptr @foo]
-
-; CHECK: invalid uses of intrinsic global variable
-; CHECK-NEXT: ptr @llvm.compiler.used
- at llvm.compiler.used = appending global [1 x ptr] [ptr @bar]
-
-define void @foo() {
-  ret void
-}
-
-define void @bar() {
-  ret void
-}
-
- at used_user = global ptr @llvm.used
- at compiler_used_user = global ptr @llvm.compiler.used


        


More information about the llvm-branch-commits mailing list