This is an archive of the discontinued LLVM Phabricator instance.

Make the recursive behavior of getBaseObject uniform for GlobalIndirectSymbols
AbandonedPublic

Authored by ibookstein on Jan 6 2021, 3:03 AM.

Details

Reviewers
DmitryPolukhin
Summary

As discussed on https://lists.llvm.org/pipermail/llvm-dev/2020-September/145031.html

Previously, the getBaseObject() on a GlobalIFunc returned its resolver function,
but calling it on a GlobalAlias which points to a GlobalIFunc returned nullptr.
This patch fixes the issue and makes the recursive traversal more uniform by
starting with this rather than getOperand(0).

Diff Detail

Event Timeline

ibookstein created this revision.Jan 6 2021, 3:03 AM
ibookstein requested review of this revision.Jan 6 2021, 3:03 AM
DmitryPolukhin accepted this revision.Jan 6 2021, 3:20 AM

I think it should fix immediate problem that we have and makes things more consistent in general.

This revision is now accepted and ready to land.Jan 6 2021, 3:20 AM

Looks like the following tests start failing as a result of this change:

Failed Tests (4):
  LLVM :: LTO/Resolution/X86/ifunc.ll
  LLVM :: LTO/Resolution/X86/ifunc2.ll
  LLVM :: Object/X86/nm-ir.ll
  LLVM :: ThinLTO/X86/empty-module.ll

I'll try to investigate.

DmitryPolukhin requested changes to this revision.Jan 9 2021, 12:01 PM

Oh, it seems that LTO is already relay on getBaseObject from ifunc :(

This revision now requires changes to proceed.Jan 9 2021, 12:01 PM

I investigated this issue a bit under debugger. It seems that there are multiple places where resolver is used as "base" object for ifunc and resolver attributes like comdat are applied to ifunc itself. It is reasonable for aliases but not for ifunc. Unfortunately it is not something that can be changed easily. The proposal with deriving GlobalIFunc from GlobalObject makes more sense to me now.