[PATCH] D54507: [ThinLTO] Handle chains of aliases
Teresa Johnson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 12 18:41:14 PST 2018
tejohnson marked an inline comment as done.
tejohnson added inline comments.
================
Comment at: lib/Transforms/Utils/CanonicalizeAliases.cpp:51
+ // Convert to a direct alias of base object.
+ GA.replaceUsesOfWith(
+ GA2, ConstantExpr::getBitCast(GA2->getBaseObject(), GA2->getType()));
----------------
tejohnson wrote:
> pcc wrote:
> > This isn't quite right; it will rewrite
> > ```
> > ga1 = alias ga2
> > ga2 = alias gep(gv, 0, 1)
> > ```
> > as
> > ```
> > ga1 = alias gv
> > ```
> > i.e. you will drop the offset from the alias. The implementation in https://reviews.llvm.org/D29781#1328720 handles this case correctly.
> You're right. We want to look at the direct aliasee (recursively). Made that change and enhanced the test case to cover this.
Actually, I think my new approach won't quite work if both aliases in the chain involve expressions - probably needs something like your ConstantExpr case in D29781. Need to construct an example.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54507/new/
https://reviews.llvm.org/D54507
More information about the llvm-commits
mailing list