This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombine] Fix for PR35761
ClosedPublic

Authored by samparker on Jan 2 2018, 7:58 AM.

Diff Detail

Event Timeline

samparker created this revision.Jan 2 2018, 7:58 AM
RKSimon added inline comments.Jan 7 2018, 2:44 AM
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
3924

It might be clearer if you just do something like:

SDValue Op0 = LogicN->getOperand(0);
SDValue Op1 = LogicN->getOperand(1);

if (isa<ConstantSDNode>(Op0))
  std::swap(Op0, Op1);

SDValue And = DAG.getNode(ISD::AND, SDLoc(Op1), Op1.getValueType(), Op1, MaskOp);
DAG.UpdateNodeOperands(LogicN, Op0, And);
test/CodeGen/X86/pr35761.ll
67

Please can you try to reduce this further

samparker updated this revision to Diff 128903.Jan 8 2018, 3:30 AM

Thanks for the suggestion Simon, I've now implemented it and simplified the test.

RKSimon accepted this revision.Jan 8 2018, 4:03 AM

LGTM - thanks

This revision is now accepted and ready to land.Jan 8 2018, 4:03 AM
This revision was automatically updated to reflect the committed changes.