-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[IR] Handle addrspacecast in findBaseObject() #162076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Make findBaseObject() look through addrspacecast, so that getAliaseeObject() works with an aliasee that uses and addrspacecast. This fixes a crash during module summary index emission. Fixes llvm#161646.
@llvm/pr-subscribers-llvm-ir Author: Nikita Popov (nikic) ChangesMake findBaseObject() look through addrspacecast, so that getAliaseeObject() works with an aliasee that uses and addrspacecast. This fixes a crash during module summary index emission. Fixes #161646. Full diff: https://github.com/llvm/llvm-project/pull/162076.diff 2 Files Affected:
diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp
index 1a7a5c5fbad6b..c3a472b0cc66d 100644
--- a/llvm/lib/IR/Globals.cpp
+++ b/llvm/lib/IR/Globals.cpp
@@ -419,6 +419,7 @@ findBaseObject(const Constant *C, DenseSet<const GlobalAlias *> &Aliases,
case Instruction::PtrToAddr:
case Instruction::PtrToInt:
case Instruction::BitCast:
+ case Instruction::AddrSpaceCast:
case Instruction::GetElementPtr:
return findBaseObject(CE->getOperand(0), Aliases, Op);
default:
diff --git a/llvm/test/Bitcode/thinlto-alias-addrspacecast.ll b/llvm/test/Bitcode/thinlto-alias-addrspacecast.ll
new file mode 100644
index 0000000000000..fe4f05e138c8a
--- /dev/null
+++ b/llvm/test/Bitcode/thinlto-alias-addrspacecast.ll
@@ -0,0 +1,7 @@
+; RUN: opt -module-summary < %s | llvm-dis | FileCheck %s
+
+@__oclc_ABI_version = linkonce_odr hidden addrspace(4) constant i32 500, align 4
+@_ZL20__oclc_ABI_version__ = internal alias i32, addrspacecast (ptr addrspace(4) @__oclc_ABI_version to ptr)
+
+; CHECK: ^1 = gv: (name: "__oclc_ABI_version", summaries: (variable: (module: ^0, flags: {{.*}})))
+; CHECK: ^2 = gv: (name: "_ZL20__oclc_ABI_version__", summaries: (alias: (module: ^0, flags: {{.*}}, aliasee: ^1)))
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/66/builds/20256 Here is the relevant piece of the build log for the reference
|
Make findBaseObject() look through addrspacecast, so that getAliaseeObject() works with an aliasee that uses and addrspacecast. This fixes a crash during module summary index emission.
Fixes #161646.