[PATCH] D99240: [ConstantFolding] Look through local aliases when simplify GEPs
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 24 20:28:03 PDT 2021
pcc requested changes to this revision.
pcc added a comment.
This revision now requires changes to proceed.
Can you make it so that the load ends up being replaced with the loaded value, without replacing the GEP itself? That would seem to address the MSVC issue.
================
Comment at: llvm/lib/IR/Value.cpp:612-613
V = cast<GlobalAlias>(V)->getAliasee();
+ } else if (StripKind == PSK_ZeroIndicesAndLocalAliases &&
+ isa<GlobalAlias>(V) && cast<GlobalAlias>(V)->hasLocalLinkage()) {
+ V = cast<GlobalAlias>(V)->getAliasee();
----------------
rnk wrote:
> I wonder if it would be safe to power up all of the other versions of pointer stripping to look through local aliases.
I don't think we should. It wouldn't be safe to allow passes to replace `@alias` with `@aliasee` with this IR:
```
@alias = internal alias @aliasee
@aliasee = linkonce_odr global i32 42
```
We should also avoid the QoI issue (missing symbol table entry) that would result from such replacement given this IR:
```
@alias = internal alias @aliasee
@aliasee = private global i32 42
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99240/new/
https://reviews.llvm.org/D99240
More information about the llvm-commits
mailing list