[all-commits] [llvm/llvm-project] e41269: [MemoryBuiltins] Cache the result of ObjectOffsetS...

Bevin Hansson via All-commits all-commits at lists.llvm.org
Fri Sep 15 01:30:59 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e412697451a921e026092d877b578a52a808f144
      https://github.com/llvm/llvm-project/commit/e412697451a921e026092d877b578a52a808f144
  Author: Bevin Hansson <59652494+bevin-hansson at users.noreply.github.com>
  Date:   2023-09-15 (Fri, 15 Sep 2023)

  Changed paths:
    M llvm/include/llvm/Analysis/MemoryBuiltins.h
    M llvm/lib/Analysis/MemoryBuiltins.cpp
    M llvm/test/Transforms/LowerConstantIntrinsics/builtin-object-size-phi.ll

  Log Message:
  -----------
  [MemoryBuiltins] Cache the result of ObjectOffsetSizeVisitor::visit. #64796 (#65326)

visit will skip visiting instructions it already has visited
to avoid issues with cycles in the data graph. However,
the result of this skipping behavior is that if we
encounter the same instruction twice, and that instruction
has a well defined result and isn't part of a cycle, we
will introduce unknowns into the analysis even though we
knew the size and offset of the instruction's result.

Instead of skipping such instructions, keep a cache of
the result of visiting them. This result is initialized
to unknown() before visiting, so if we happen to visit
it again recursively (perhaps as the result of a cycle
or a phi), we will get unknown as the cached result and
exit out.




More information about the All-commits mailing list