7 Commits

Author SHA1 Message Date
Yingwei Zheng
26fbdff458
[ConstraintElim] Refactor checkCondition. NFC. (#75319)
This patch refactors `checkCondition` to handle min/max intrinsic calls
in #75306.
2023-12-13 23:20:01 +08:00
Florian Hahn
4a5bcbd560
[ConstraintElim] Store conditional facts as (Predicate, Op0, Op1).
This allows to add facts even if no corresponding ICmp instruction
exists in the IR.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D158837
2023-08-30 10:54:28 +01:00
Antonio Frighetto
420cf63ead [ConstraintElimination] Refactor checkAndReplaceCondition (NFC)
Handling `true` and `false` constant replacements is now abstracted
out into a single lambda function `ReplaceCmpWithConstant`, so as to
reduce code duplication.
2023-06-05 16:54:58 +02:00
Florian Hahn
9497680067
[ConstraintElim] Update getLastConstraint to return to last row. (NFC)
The current code incorrectly returned the first instead of the last row.
This fixes the debug output.
2023-02-10 17:12:21 +00:00
Florian Hahn
57606bb356
[ConstraintElim] Improve debug test to show removed constraints (NFC).
The current checks show incorrect debug output.
2023-02-10 16:26:38 +00:00
Florian Hahn
6887cfb982
[ConstraintElim] Queue facts and checks directly.
This allows interleaving facts and checks in a single block. In
particular this enables using facts from assumes for conditions in the
same block that come after the assume.

This could be extended to only try to simplify checks at the point where
a condition is used.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D138452
2022-12-05 16:44:20 +00:00
Florian Hahn
c1bfa41428
[ConstraintElimination] Add test for debug printing. 2022-10-03 20:56:39 +01:00