This is an archive of the discontinued LLVM Phabricator instance.

[InstSimplify] Fold !(X || Y) && X --> false
ClosedPublic

Authored by bcl5980 on Nov 28 2022, 12:23 PM.

Diff Detail

Event Timeline

bcl5980 created this revision.Nov 28 2022, 12:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 28 2022, 12:23 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
bcl5980 requested review of this revision.Nov 28 2022, 12:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 28 2022, 12:23 PM
bcl5980 added inline comments.Nov 28 2022, 12:25 PM
llvm/lib/Analysis/InstructionSimplify.cpp
4574

I guess this pattern also can't accept undef/poision for vector case.

bcl5980 updated this revision to Diff 478426.Nov 28 2022, 5:32 PM
bcl5980 added inline comments.Nov 28 2022, 5:40 PM
llvm/lib/Analysis/InstructionSimplify.cpp
4574

Just ignore the comment. I am wrong.

spatel added inline comments.Nov 29 2022, 6:02 AM
llvm/lib/Analysis/InstructionSimplify.cpp
4576–4577

Shorten:

if (match(Cond, m_Not(m_c_LogicalOr(m_Specific(TrueVal), m_Value()))))
llvm/test/Transforms/InstSimplify/select-logical.ll
193

typo: comute -> commute

227

The FalseVal of %r is not zero, so this is not showing what the comment describes. This might need a TODO if we don't match the first select as logical-or?

bcl5980 edited the summary of this revision. (Show Details)Nov 29 2022, 6:11 AM
bcl5980 added inline comments.
llvm/test/Transforms/InstSimplify/select-logical.ll
227

I'm sorry , this should be a typo.

bcl5980 updated this revision to Diff 478558.Nov 29 2022, 6:23 AM

address comments.

spatel accepted this revision.Nov 29 2022, 6:25 AM

LGTM

This revision is now accepted and ready to land.Nov 29 2022, 6:25 AM
This revision was landed with ongoing or failed builds.Nov 29 2022, 6:45 AM
This revision was automatically updated to reflect the committed changes.