[PATCH] D118799: [ConstraintElimination] Allow adding pre-conditions for constraints.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 2 07:58:37 PST 2022


fhahn created this revision.
fhahn added reviewers: reames, nikic, spatel, nlopes.
Herald added a subscriber: hiraditya.
fhahn requested review of this revision.
Herald added a project: LLVM.

With this patch pre-conditions can be added to a list of constraints.
Constraints with pre-conditions can only be used if all pre-conditions
are satisfied when the constraint is used.

The pre-conditions at the moment are specified as a list of
(Predicate, Value *,Value *) tuples. This allow easily checking them
like any other condition, using the existing infrastructure.

This then is used to limit GEP decomposition to cases where we can
prove that offsets are signed positive.

This fixes a couple of incorrect transforms where GEP offsets where
assumed to be signed positive, but they were not.

Note that this effectively disables GEP decomposition, as there's no
support for reasoning about signed predicates. I will post a patch to do
so soon.

Fixes PR49624.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118799

Files:
  llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
  llvm/test/Transforms/ConstraintElimination/gep-arithmetic.ll
  llvm/test/Transforms/ConstraintElimination/geps-unsigned-predicates.ll
  llvm/test/Transforms/ConstraintElimination/large-system-growth.ll
  llvm/test/Transforms/ConstraintElimination/loops-bottom-tested-pointer-cmps.ll
  llvm/test/Transforms/ConstraintElimination/loops-header-tested-pointer-cmps.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118799.405282.patch
Type: text/x-patch
Size: 22021 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220202/363f4c17/attachment.bin>


More information about the llvm-commits mailing list