[PATCH] D65118: Analysis: Don't look through aliases when simplifying GEPs.

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 23 11:42:30 PDT 2019


jdoerfert added a comment.

In D65118#1597600 <https://reviews.llvm.org/D65118#1597600>, @pcc wrote:

> Another way to look at it is that this:
>
>   @a = private constant i8* @x
>   @b = linkonce_odr alias @a
>
>
> should be equivalent to:
>
>   @b = linkonce_odr constant i8* @x
>
>
> except that we also have a way of referencing this module's copy of `@b` via `@a`. See also https://llvm.org/bugs/show_bug.cgi?id=27866 where this was discussed as a "canonical" form of aliases.


So I looked into this a bit and the code in stripPointerXXX currently checks for:

  /// Return true if this global's definition can be substituted with an
  /// *arbitrary* definition at link time.  We cannot do any IPO or inlinining
  /// across interposable call edges, since the callee can be replaced with
  /// something arbitrary at link time.
  bool isInterposable() const;

not

  /// Returns true if the definition of this global may be replaced by a
     /// differently optimized variant of the same source level function at link
     /// time.
     bool mayBeDerefined() const;

which is `!isDefinitionExact()`.

What do you think?


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65118/new/

https://reviews.llvm.org/D65118





More information about the llvm-commits mailing list