[PATCH] D136174: [BasicAA] Replace VisitedPhiBBs with a single flag

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 18 07:18:26 PDT 2022


nikic created this revision.
nikic added reviewers: reames, fhahn, asbirlea, jdoerfert.
Herald added subscribers: jeroen.dobbelaere, hiraditya.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

When looking through phis, BasicAA has to guard against the possibility that values from two separate cycle iterations are being compared -- in this case, even though the SSA values may be the same, they cannot be considered as equal.

This is currently done by keeping a set of VisitedPhiBBs for any phis we looked through, and then checking whether the relevant instruction is reachable from one of the phis.

This patch replaces this set with a single flag. If the flag is set, then we will not assume equality for any instruction part of a cycle. While this is nominally less accurate, it makes essentially no difference in practice. Here are the AA stats for test-suite:

  aa.NumMayAlias  |   3072005 |  3072016
  aa.NumMustAlias |    337858 |   337854
  aa.NumNoAlias   |  13255345 | 13255349

The motivation for the change is to expose the MayBeCrossIteration flag to AA users, which will allow fixing miscompiles related to incorrect handling of cross-iteration AA queries.


https://reviews.llvm.org/D136174

Files:
  llvm/include/llvm/Analysis/BasicAliasAnalysis.h
  llvm/lib/Analysis/BasicAliasAnalysis.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136174.468527.patch
Type: text/x-patch
Size: 5383 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221018/a7128d47/attachment.bin>


More information about the llvm-commits mailing list