[all-commits] [llvm/llvm-project] 753c51: [AST] Fix size merging for MustAlias sets (#73820)

Nikita Popov via All-commits all-commits at lists.llvm.org
Thu Dec 7 01:46:01 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 753c51bf889e605a2daf92e1710d7ad5ebc76ec3
      https://github.com/llvm/llvm-project/commit/753c51bf889e605a2daf92e1710d7ad5ebc76ec3
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-12-07 (Thu, 07 Dec 2023)

  Changed paths:
    M llvm/lib/Analysis/AliasSetTracker.cpp
    M llvm/test/Transforms/LICM/pr64897.ll

  Log Message:
  -----------
  [AST] Fix size merging for MustAlias sets (#73820)

AST checks aliasing with MustAlias sets by only checking the
representative pointer (getSomePointer). This is only correct if the
Size and AATags information of that pointer also includes the
Size/AATags of all other pointers in the set.

When we add a new pointer to the AliasSet, we do perform this update
(see the code in AliasSet::addPointer). However, if a pointer already in
the MustAlias set is used with a new size, we currently do not update
the representative pointer, resulting in miscompilations. Fix this by
adding the missing update.

This is a targeted fix using the current representation. There are a
couple of alternatives:
* For MustAlias sets, don't store per-pointer Size/AATags at all. This
would make it clear that there is only one set of common Size/AATags for
all pointers.
* Check against all pointers in the set even for MustAlias. This is what
https://github.com/llvm/llvm-project/pull/65731 proposes to do as part
of a larger change to AST representation.

Fixes https://github.com/llvm/llvm-project/issues/64897.




More information about the All-commits mailing list