]> granicus.if.org Git - llvm/commit
IR: Teach GlobalIndirectSymbol::getBaseObject() to handle more kinds of expressions.
authorPeter Collingbourne <peter@pcc.me.uk>
Wed, 24 Jul 2019 22:23:05 +0000 (22:23 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Wed, 24 Jul 2019 22:23:05 +0000 (22:23 +0000)
commit6b82f4e52628372b41a7426d4c14b81cbbbc3700
treefbf62b011ff7b2246e29c70de20e1fcdf627c75c
parent20c74d808ab9741e14769b08efbe393c007e2095
IR: Teach GlobalIndirectSymbol::getBaseObject() to handle more kinds of expressions.

For aliases, any expression that lowers at the MC level to global_object or
global_object+constant is valid at the object file level. getBaseObject()
should return a result if the aliasee ends up being of that form even if
the IR used to produce it is somewhat unconventional.

Note that this is different from what stripInBoundsOffsets() and that family
of functions is doing. Those functions are concerned about semantic properties
of IR, whereas here we only care about the lowering result.

Therefore reimplement getBaseObject() in a way that matches the lowering
result. This fixes a crash when producing a summary for aliases such as
that in the included test case.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366952 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/GlobalIndirectSymbol.h
lib/IR/Globals.cpp
test/Bitcode/thinlto-alias3.ll [new file with mode: 0644]
test/Linker/comdat8.ll