[SelectionDAG] Make binop reduction matcher available to all targets
ClosedPublic

Authored by RKSimon on Jul 31 2018, 10:49 AM.

Details

Summary

There is nothing x86-specific about this code, so it'd be nice to make this available for other targets to use in the future (and get it out of X86ISelLowering!). Although an initial trawl through other targets didn't find existing equivalent code.

Diff Detail

Repository
rL LLVM
RKSimon created this revision.Jul 31 2018, 10:49 AM
hfinkel added inline comments.Jul 31 2018, 11:10 AM
include/llvm/CodeGen/SelectionDAG.h
1510 ↗(On Diff #158323)

This looks like a good thing to put in target-independent code (especially because it is matching a canonical form). We should document BinOp and CandidateBinOps here. Also. where is BinOp unsigned and CandidateBinOps is an array of ISD::NodeType? Should BinOp also be ISD::NodeType& ?

RKSimon added inline comments.Jul 31 2018, 11:16 AM
include/llvm/CodeGen/SelectionDAG.h
1510 ↗(On Diff #158323)

That was how it was in x86 - but we should clean it up here. Should we stick to ISD::NodeType or should we relax it to unsigned to allow us to use target ISD opcodes?

RKSimon updated this revision to Diff 158488.Aug 1 2018, 3:47 AM

Consistently use ISD::NodeType for arg types and improve description comments

hfinkel accepted this revision.Aug 1 2018, 8:34 AM

LGTM

This revision is now accepted and ready to land.Aug 1 2018, 8:34 AM
This revision was automatically updated to reflect the committed changes.