This is an archive of the discontinued LLVM Phabricator instance.

[PatternMatch][LVI] Handle select-form and/or in LVI
ClosedPublic

Authored by nikic on Dec 26 2020, 12:58 PM.

Details

Summary

Following the discussion in D93065, this adds m_LogicalAnd() and m_LogicalOr() matchers, that match A && B and A || B logical operations, either as bitwise operations or select expressions. As an example usage, LVI is adapted to use these matchers for its condition reasoning.

The plan here is to switch other parts of LLVM that reason about and/or of conditions to also support the select forms, and then merge D93065 (or some close variant) to disable the incorrect select -> and/or transform.

Diff Detail

Event Timeline

nikic created this revision.Dec 26 2020, 12:58 PM
nikic requested review of this revision.Dec 26 2020, 12:58 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 26 2020, 12:58 PM
aqjune accepted this revision.EditedDec 27 2020, 2:00 AM

LGTM

Limited to this patch, using LogicalAnd/LogicalOr is sound, because if the branch is taken/not taken, 'select x, y, false' is equivalent to 'and x, y' and also 'select x, true, y' is to 'or x, y'.

This revision is now accepted and ready to land.Dec 27 2020, 2:00 AM
This revision was landed with ongoing or failed builds.Dec 27 2020, 8:41 AM
This revision was automatically updated to reflect the committed changes.