[all-commits] [llvm/llvm-project] 1a6e1e: Resolve {GlobalValue, GloalIndirectSymol}::getBaseO...

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Sep 23 09:23:48 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1a6e1ee42a6af255d45e3fd2fe87021dd31f79bb
      https://github.com/llvm/llvm-project/commit/1a6e1ee42a6af255d45e3fd2fe87021dd31f79bb
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-09-23 (Thu, 23 Sep 2021)

  Changed paths:
    M llvm/include/llvm/IR/GlobalAlias.h
    M llvm/include/llvm/IR/GlobalIFunc.h
    M llvm/lib/IR/Globals.cpp
    M llvm/lib/Object/IRSymtab.cpp
    M llvm/lib/Object/ModuleSymbolTable.cpp
    M llvm/lib/Transforms/Utils/SplitModule.cpp
    M llvm/test/LTO/Resolution/X86/ifunc.ll

  Log Message:
  -----------
  Resolve {GlobalValue,GloalIndirectSymol}::getBaseObject confusion

While both GlobalAlias and GlobalIFunc are GlobalIndirectSymbol, their
`getIndirectSymbol()` usage is quite different (GlobalIFunc's resolver
is an entity different from GlobalIFunc itself).

As discussed on https://lists.llvm.org/pipermail/llvm-dev/2020-September/144904.html
("[IR] Modelling of GlobalIFunc"), the name `getBaseObject` is confusing when
used with GlobalIFunc.

To resolve the confusion:

* Move GloalIndirectSymol::getBaseObject to GlobalAlias:: (GlobalIFunc should use `getResolver` instead)
* Change GlobalValue::getBaseObject not to inspect GlobalIFunc. Note: the function has 7 references.
* Add GlobalIFunc::getResolverFunction to peel off potential ConstantExpr indirection
  (`strlen` in `test/LTO/Resolution/X86/ifunc.ll`)

Note: GlobalIFunc::getResolver (like GlobalAlias::getAliasee which does not peel
off ConstantExpr indirection) is kept to be used by ValueEnumerator.

Reviewed By: ibookstein

Differential Revision: https://reviews.llvm.org/D109792




More information about the All-commits mailing list