[llvm] 536872a - [OpaquePtr] Enumerate global variable type
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 25 01:46:43 PDT 2021
Author: Nikita Popov
Date: 2021-06-25T10:46:28+02:00
New Revision: 536872a1f7a1f9fa72591e1424eaece39f5edd1a
URL: https://github.com/llvm/llvm-project/commit/536872a1f7a1f9fa72591e1424eaece39f5edd1a
DIFF: https://github.com/llvm/llvm-project/commit/536872a1f7a1f9fa72591e1424eaece39f5edd1a.diff
LOG: [OpaquePtr] Enumerate global variable type
This is no longer implicitly enumerated through the pointer type.
Added:
Modified:
llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
llvm/test/Other/force-opaque-ptrs.ll
Removed:
################################################################################
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
index 6177202bcce86..7baed6c8feed8 100644
--- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
@@ -365,8 +365,10 @@ ValueEnumerator::ValueEnumerator(const Module &M,
UseListOrders = predictUseListOrder(M);
// Enumerate the global variables.
- for (const GlobalVariable &GV : M.globals())
+ for (const GlobalVariable &GV : M.globals()) {
EnumerateValue(&GV);
+ EnumerateType(GV.getValueType());
+ }
// Enumerate the functions.
for (const Function & F : M) {
diff --git a/llvm/test/Other/force-opaque-ptrs.ll b/llvm/test/Other/force-opaque-ptrs.ll
index fa1d9e0237bb2..486af5a379bd3 100644
--- a/llvm/test/Other/force-opaque-ptrs.ll
+++ b/llvm/test/Other/force-opaque-ptrs.ll
@@ -1,9 +1,14 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: llvm-as --force-opaque-pointers < %s | llvm-dis | FileCheck %s
; RUN: llvm-as < %s | llvm-dis --force-opaque-pointers | FileCheck %s
; RUN: opt --force-opaque-pointers < %s -S | FileCheck %s
-; CHECK: define void @f(ptr %p)
-; CHECK: ret void
+; CHECK: @g = external global i16
+ at g = external global i16
+
define void @f(i32* %p) {
+; CHECK-LABEL: @f(
+; CHECK-NEXT: ret void
+;
ret void
}
More information about the llvm-commits
mailing list