[all-commits] [llvm/llvm-project] a75974: [InstCombine] Support multiple comparisons in fold...

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Apr 14 02:35:59 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a75974516903a91897b042d065c968ba96d745d7
      https://github.com/llvm/llvm-project/commit/a75974516903a91897b042d065c968ba96d745d7
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-04-14 (Fri, 14 Apr 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineInternal.h
    M llvm/test/Transforms/InstCombine/compare-alloca.ll

  Log Message:
  -----------
  [InstCombine] Support multiple comparisons in foldAllocaCmp()

foldAllocaCmp() needs to fold all comparisons of an alloca at the
same time, to ensure that there is a consistent view of the alloca
address. Currently, it folds "all" comparisons by limiting to the
case where there is only one. This patch switches the algorithm to
instead actually collect and fold all comparisons.

Something we need to be careful about here is that there may be
comparisons where both sides of the icmp are based on the alloca.
Such comparisons are comparing offsets of the alloca, and as such
can be ignored here, but shouldn't be folded to false.

Differential Revision: https://reviews.llvm.org/D144492




More information about the All-commits mailing list