[PATCH] D152730: [ConstraintElim] Add A < B if A is an increasing phi for A != B.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 12 10:30:10 PDT 2023


fhahn created this revision.
fhahn added reviewers: zjaffal, nikic, mkazantsev, rapidsna, antoniofrighetto.
Herald added subscribers: ormris, StephenFan, steven_wu, javed.absar, hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added a project: LLVM.

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 initial patch only covers pointer comparisons, but I will shortly
share a follow-up for integer inductions, which will also handle #63125
(looks like this is hardened glibc++).

The patch hand-rolls detection of inductions (instead of using
something like isInduction from IVDescriptors.h) to avoid pulling in
SCEV. It adds LoopInfo, but this doesn't seem to have any noticable
compile-time impact.

Depends on D151799 <https://reviews.llvm.org/D151799>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152730

Files:
  llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-lto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-defaults.ll
  llvm/test/Transforms/ConstraintElimination/analysis-invalidation.ll
  llvm/test/Transforms/ConstraintElimination/and-implied-by-operands.ll
  llvm/test/Transforms/ConstraintElimination/monotonic-pointer-phis.ll
  llvm/test/Transforms/PhaseOrdering/iterator-with-runtime-check.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152730.530583.patch
Type: text/x-patch
Size: 21415 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230612/bf7f73da/attachment.bin>


More information about the llvm-commits mailing list