[all-commits] [llvm/llvm-project] e6a165: [ConstraintElim] Add A < B if A is an increasing p...

Florian Hahn via All-commits all-commits at lists.llvm.org
Wed Sep 27 03:00:45 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e6a1657fa30c747f4412fc47f567660ebe861a9e
      https://github.com/llvm/llvm-project/commit/e6a1657fa30c747f4412fc47f567660ebe861a9e
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2023-09-27 (Wed, 27 Sep 2023)

  Changed paths:
    M llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
    M llvm/test/Other/new-pm-defaults.ll
    M llvm/test/Other/new-pm-lto-defaults.ll
    M llvm/test/Other/new-pm-thinlto-postlink-defaults.ll
    M llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
    M llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
    M llvm/test/Other/new-pm-thinlto-prelink-defaults.ll
    M llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
    M llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
    M llvm/test/Transforms/ConstraintElimination/analysis-invalidation.ll
    M llvm/test/Transforms/ConstraintElimination/loops-header-tested-pointer-cmps.ll
    M llvm/test/Transforms/ConstraintElimination/monotonic-int-phis-wrapping.ll
    M llvm/test/Transforms/ConstraintElimination/monotonic-int-phis.ll
    M llvm/test/Transforms/ConstraintElimination/monotonic-pointer-phis-constant-upper-offset.ll
    M llvm/test/Transforms/ConstraintElimination/monotonic-pointer-phis-custom-datalayout.ll
    M llvm/test/Transforms/ConstraintElimination/monotonic-pointer-phis-early-exits.ll
    M llvm/test/Transforms/ConstraintElimination/monotonic-pointer-phis-struct-types.ll
    M llvm/test/Transforms/ConstraintElimination/monotonic-pointer-phis.ll
    M llvm/test/Transforms/PhaseOrdering/loop-access-checks.ll

  Log Message:
  -----------
  [ConstraintElim] Add A < B if A is an increasing phi for A != B.

This patch adds additional logic to add additional facts for A != B, if
A is a monotonically increasing induction phi. The motivating use case
for this is removing checks when using iterators with hardened libc++,
e.g. https://godbolt.org/z/zhKEP37vG.

The patch pulls in SCEV to detect AddRecs. If possible, the patch adds
the following facts for a AddRec phi PN with StartValue as incoming
value from the loo preheader and B being an upper bound for PN from a
condition in the loop header.

 * (ICMP_UGE, PN, StartValue)
 * (ICMP_ULT, PN, B) [if (ICMP_ULE, StartValue, B)]

The patch also adds an optional precondition to FactOrCheck (the new
DoesHold field) , which can be used to only add a fact if the
precondition holds at the point the fact is added to the constraint
system.

Depends on D151799.

Reviewed By: nikic

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




More information about the All-commits mailing list