[llvm] 5b2573e - [OpaquePtr] Enumerate GlobalAlias value type

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 25 12:21:20 PDT 2021


Author: Nikita Popov
Date: 2021-06-25T21:21:10+02:00
New Revision: 5b2573e9c7c9fdbd80cb58711714955479573054

URL: https://github.com/llvm/llvm-project/commit/5b2573e9c7c9fdbd80cb58711714955479573054
DIFF: https://github.com/llvm/llvm-project/commit/5b2573e9c7c9fdbd80cb58711714955479573054.diff

LOG: [OpaquePtr] Enumerate GlobalAlias value type

The type 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 c347c401a5b9..2be3ca741f16 100644
--- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
+++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
@@ -378,8 +378,10 @@ ValueEnumerator::ValueEnumerator(const Module &M,
   }
 
   // Enumerate the aliases.
-  for (const GlobalAlias &GA : M.aliases())
+  for (const GlobalAlias &GA : M.aliases()) {
     EnumerateValue(&GA);
+    EnumerateType(GA.getValueType());
+  }
 
   // Enumerate the ifuncs.
   for (const GlobalIFunc &GIF : M.ifuncs())

diff  --git a/llvm/test/Other/force-opaque-ptrs.ll b/llvm/test/Other/force-opaque-ptrs.ll
index 81dfd22458dc..e80fdce0e6e2 100644
--- a/llvm/test/Other/force-opaque-ptrs.ll
+++ b/llvm/test/Other/force-opaque-ptrs.ll
@@ -1,4 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
+; RUN: llvm-as --force-opaque-pointers < %s | llvm-dis --force-opaque-pointers | FileCheck %s
 ; RUN: llvm-as < %s | llvm-dis --force-opaque-pointers | FileCheck %s
 ; RUN: opt --force-opaque-pointers < %s -S | FileCheck %s
 
@@ -9,6 +10,9 @@
 @g2 = global i18 0
 @ga = alias i18, i18* @g2
 
+; CHECK: @ga2 = alias i19, ptr @g2
+ at ga2 = alias i19, i19* bitcast (i18* @g2 to i19*)
+
 define void @f(i32* %p) {
 ; CHECK-LABEL: define {{[^@]+}}@f
 ; CHECK-SAME: (ptr [[P:%.*]]) {


        


More information about the llvm-commits mailing list