| #
e6a1657f |
| 27-Sep-2023 |
Florian Hahn <flo@fhahn.com> |
[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
[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
show more ...
|