This is an archive of the discontinued LLVM Phabricator instance.

DAG: Use getNegatedExpression in combineMinNumMaxNum
ClosedPublic

Authored by arsenm on Dec 19 2022, 11:03 AM.

Details

Summary

Computing the negated RHS expression just to see if it compares equal
and throw it away feels dirty.

Diff Detail

Event Timeline

arsenm created this revision.Dec 19 2022, 11:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 19 2022, 11:03 AM
arsenm requested review of this revision.Dec 19 2022, 11:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 19 2022, 11:03 AM
Herald added a subscriber: wdng. · View Herald Transcript
RKSimon added inline comments.Jan 20 2023, 6:18 AM
llvm/include/llvm/CodeGen/TargetLowering.h
4098

(style) either create a if (Neg) {} outer wrapper or do a if (!Neg) return SDValue(); early-out

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
392

drop DAG?

10402

Might be worth converting the static method to DAGCombiner::combineMinNumMaxNum as a NFC pre-commit.

10420–10429

Move this into the braces above? Its looks that's the only place Combined could be set

arsenm updated this revision to Diff 491114.Jan 21 2023, 6:32 PM
arsenm marked an inline comment as done.

Address comments, reduce duplication

RKSimon accepted this revision.Jan 22 2023, 4:46 AM

LGTM - cheers

This revision is now accepted and ready to land.Jan 22 2023, 4:46 AM