[PATCH] D81911: [IR] Fix getBaseObject for GlobalAlias-to-GlobalIFunc

Itay Bookstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 16 00:31:01 PDT 2020


nextsilicon-itay-bookstein created this revision.
nextsilicon-itay-bookstein added reviewers: pcc, tejohnson.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

Previously, GlobalAlias::getBaseObject would return nullptr
when the aliasee is a GlobalIFunc. This patch adds handling
for the case where the aliasee is a GlobalIFunc.

Fixes https://bugs.llvm.org/show_bug.cgi?id=46340


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81911

Files:
  llvm/lib/IR/Globals.cpp


Index: llvm/lib/IR/Globals.cpp
===================================================================
--- llvm/lib/IR/Globals.cpp
+++ llvm/lib/IR/Globals.cpp
@@ -444,6 +444,8 @@
 findBaseObject(const Constant *C, DenseSet<const GlobalAlias *> &Aliases) {
   if (auto *GO = dyn_cast<GlobalObject>(C))
     return GO;
+  if (auto *GI = dyn_cast<GlobalIFunc>(C))
+    return findBaseObject(GI->getOperand(0), Aliases);
   if (auto *GA = dyn_cast<GlobalAlias>(C))
     if (Aliases.insert(GA).second)
       return findBaseObject(GA->getOperand(0), Aliases);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81911.270971.patch
Type: text/x-patch
Size: 551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200616/5c0ea530/attachment.bin>


More information about the llvm-commits mailing list