[all-commits] [llvm/llvm-project] 08ed21: [IR] Refactor GlobalIFunc to inherit from GlobalOb...
Itay Bookstein via All-commits
all-commits at lists.llvm.org
Wed Oct 20 10:30:06 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 08ed216000b6503a4a4be52f18394d008d5fb8f4
https://github.com/llvm/llvm-project/commit/08ed216000b6503a4a4be52f18394d008d5fb8f4
Author: Itay Bookstein <ibookstein at gmail.com>
Date: 2021-10-20 (Wed, 20 Oct 2021)
Changed paths:
M clang/lib/CodeGen/CodeGenModule.cpp
M llvm/include/llvm-c/Core.h
M llvm/include/llvm/AsmParser/LLParser.h
M llvm/include/llvm/CodeGen/AsmPrinter.h
M llvm/include/llvm/IR/GlobalAlias.h
M llvm/include/llvm/IR/GlobalIFunc.h
R llvm/include/llvm/IR/GlobalIndirectSymbol.h
M llvm/include/llvm/IR/GlobalObject.h
M llvm/include/llvm/IR/Value.h
M llvm/include/llvm/Transforms/Utils/ValueMapper.h
M llvm/lib/AsmParser/LLParser.cpp
M llvm/lib/Bitcode/Reader/BitcodeReader.cpp
M llvm/lib/Bitcode/Reader/MetadataLoader.cpp
M llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
M llvm/lib/IR/AsmWriter.cpp
M llvm/lib/IR/Globals.cpp
M llvm/lib/Linker/IRMover.cpp
M llvm/lib/Object/ModuleSymbolTable.cpp
M llvm/lib/Transforms/IPO/LowerTypeTests.cpp
M llvm/lib/Transforms/Utils/SplitModule.cpp
M llvm/lib/Transforms/Utils/ValueMapper.cpp
M llvm/unittests/IR/ConstantsTest.cpp
Log Message:
-----------
[IR] Refactor GlobalIFunc to inherit from GlobalObject, Remove GlobalIndirectSymbol
As discussed in:
* https://reviews.llvm.org/D94166
* https://lists.llvm.org/pipermail/llvm-dev/2020-September/145031.html
The GlobalIndirectSymbol class lost most of its meaning in
https://reviews.llvm.org/D109792, which disambiguated getBaseObject
(now getAliaseeObject) between GlobalIFunc and everything else.
In addition, as long as GlobalIFunc is not a GlobalObject and
getAliaseeObject returns GlobalObjects, a GlobalAlias whose aliasee
is a GlobalIFunc cannot currently be modeled properly. Creating
aliases for GlobalIFuncs does happen in the wild (e.g. glibc). In addition,
calling getAliaseeObject on a GlobalIFunc will currently return nullptr,
which is undesirable because it should return the object itself for
non-aliases.
This patch refactors the GlobalIFunc class to inherit directly from
GlobalObject, and removes GlobalIndirectSymbol (while inlining the
relevant parts into GlobalAlias and GlobalIFunc). This allows for
calling getAliaseeObject() on a GlobalIFunc to return the GlobalIFunc
itself, making getAliaseeObject() more consistent and enabling
alias-to-ifunc to be properly modeled in the IR.
I exercised some judgement in the API clients of GlobalIndirectSymbol:
some were 'monomorphized' for GlobalAlias and GlobalIFunc, and
some remained shared (with the type adapted to become GlobalValue).
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D108872
More information about the All-commits
mailing list