[llvm] 97d00b7 - [Verifier] Allow dllexport protected after D133267
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 6 15:28:38 PDT 2022
Author: Fangrui Song
Date: 2022-09-06T15:28:29-07:00
New Revision: 97d00b72a2b0a7aca631e1402a647f32c4e8bafb
URL: https://github.com/llvm/llvm-project/commit/97d00b72a2b0a7aca631e1402a647f32c4e8bafb
DIFF: https://github.com/llvm/llvm-project/commit/97d00b72a2b0a7aca631e1402a647f32c4e8bafb.diff
LOG: [Verifier] Allow dllexport protected after D133267
I have noticed that this combo makes sense (D133266) but rejected it for
simplicity. It turns out to be used by PlayStation, so let's allow it.
Added:
Modified:
llvm/lib/IR/Verifier.cpp
llvm/test/Verifier/dllstorage.ll
Removed:
################################################################################
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index da19afa9d1bb3..39217421a96de 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -664,8 +664,9 @@ void Verifier::visitGlobalValue(const GlobalValue &GV) {
Check(!GV.hasComdat(), "Declaration may not be in a Comdat!", &GV);
if (GV.hasDLLExportStorageClass()) {
- Check(GV.hasDefaultVisibility(),
- "dllexport GlobalValue must have default visibility", &GV);
+ Check(!GV.hasHiddenVisibility(),
+ "dllexport GlobalValue must have default or protected visibility",
+ &GV);
}
if (GV.hasDLLImportStorageClass()) {
Check(GV.hasDefaultVisibility(),
diff --git a/llvm/test/Verifier/dllstorage.ll b/llvm/test/Verifier/dllstorage.ll
index 4791691c5214c..8885d0fce8783 100644
--- a/llvm/test/Verifier/dllstorage.ll
+++ b/llvm/test/Verifier/dllstorage.ll
@@ -3,16 +3,14 @@
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-gnu"
-; CHECK: dllexport GlobalValue must have default visibility
+; CHECK: dllexport GlobalValue must have default or protected visibility
; CHECK-NEXT: ptr @dllexport_hidden
declare hidden dllexport i32 @dllexport_hidden()
-; CHECK: dllexport GlobalValue must have default visibility
-; CHECK-NEXT: ptr @dllexport_protected
declare protected dllexport i32 @dllexport_protected()
-; CHECK: dllimport GlobalValue must have default visibility
+; CHECK-NEXT: dllimport GlobalValue must have default visibility
; CHECK-NEXT: ptr @dllimport_hidden
declare hidden dllimport i32 @dllimport_hidden()
-; CHECK: dllimport GlobalValue must have default visibility
+; CHECK-NEXT: dllimport GlobalValue must have default visibility
; CHECK-NEXT: ptr @dllimport_protected
declare protected dllimport i32 @dllimport_protected()
More information about the llvm-commits
mailing list