diff options
| author | Peter Collingbourne <peter@pcc.me.uk> | 2019-07-24 22:23:05 +0000 |
|---|---|---|
| committer | Peter Collingbourne <peter@pcc.me.uk> | 2019-07-24 22:23:05 +0000 |
| commit | 72391ab4f168dc380d4cc3a37c2b4ebd93c75083 (patch) | |
| tree | 736d16e279673b155c4559030f59e8f109e65d04 /llvm/include | |
| parent | 13af1ed8e37c3f53b4dbd03f7c40b069d4895087 (diff) | |
| download | bcm5719-llvm-72391ab4f168dc380d4cc3a37c2b4ebd93c75083.tar.gz bcm5719-llvm-72391ab4f168dc380d4cc3a37c2b4ebd93c75083.zip | |
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
llvm-svn: 366952
Diffstat (limited to 'llvm/include')
| -rw-r--r-- | llvm/include/llvm/IR/GlobalIndirectSymbol.h | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/llvm/include/llvm/IR/GlobalIndirectSymbol.h b/llvm/include/llvm/IR/GlobalIndirectSymbol.h index 8bc3f90b94a..678c038d88e 100644 --- a/llvm/include/llvm/IR/GlobalIndirectSymbol.h +++ b/llvm/include/llvm/IR/GlobalIndirectSymbol.h @@ -54,9 +54,7 @@ public: static_cast<const GlobalIndirectSymbol *>(this)->getIndirectSymbol()); } - const GlobalObject *getBaseObject() const { - return dyn_cast<GlobalObject>(getIndirectSymbol()->stripInBoundsOffsets()); - } + const GlobalObject *getBaseObject() const; GlobalObject *getBaseObject() { return const_cast<GlobalObject *>( static_cast<const GlobalIndirectSymbol *>(this)->getBaseObject()); |

