This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Transform `(icmp eq/ne (or x, C), x)` -> `(icmp eq/ne (and x, C), C)`
AbandonedPublic

Authored by goldstein.w.n on Jun 29 2023, 12:50 PM.

Details

Summary

This eliminates a use on x which can enable other transforms. As
well and is often easier to analyze than or.

Proof: https://alive2.llvm.org/ce/z/N4CcaK

Diff Detail

Event Timeline

goldstein.w.n created this revision.Jun 29 2023, 12:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 29 2023, 12:50 PM
goldstein.w.n requested review of this revision.Jun 29 2023, 12:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 29 2023, 12:50 PM

Proof (note constants are always noundef): https://alive2.llvm.org/ce/z/N4CcaK

undef is a constant :) Or more typically in this context, a vector with undef elements.

Add check for undef

goldstein.w.n edited the summary of this revision. (Show Details)Jun 30 2023, 1:58 PM

Proof (note constants are always noundef): https://alive2.llvm.org/ce/z/N4CcaK

undef is a constant :) Or more typically in this context, a vector with undef elements.

Oof, fixed.

nikic added a comment.Aug 20 2023, 8:03 AM

I believe this has been obsoleted by the recently added icmp or folds?

goldstein.w.n abandoned this revision.Aug 20 2023, 10:30 AM

Yeah. Obsolete now.