This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Fold away CMP/CSINC from CMOV
ClosedPublic

Authored by dmgreen on Dec 6 2021, 1:45 PM.

Details

Summary

This makes use of the code in D114013 to fold away unnecessary CMPZ/CSINC starting from a CMOV, in a similar way to how we fold away CSINV/CSINC/etc

Diff Detail

Event Timeline

dmgreen created this revision.Dec 6 2021, 1:45 PM
dmgreen requested review of this revision.Dec 6 2021, 1:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 6 2021, 1:45 PM
samtebbs added inline comments.Dec 9 2021, 9:02 AM
llvm/lib/Target/ARM/ARMISelLowering.cpp
18036–18047

There's a decent amount of duplication here. Would it be neater to do something like:

code = -1
if (N->getConstantOperandVal(2) == EQ)
  code = getTargetConstant(...)
else if (N->getConstantOperandVal(2) == NE)
  code = getOppositeCondition(...)

if (code != -1)
  return DAG.getNode(,,,)

?

dmgreen updated this revision to Diff 393432.Dec 10 2021, 3:34 AM

Thanks for the suggestion. Rejigged the code to only have a single DAG.getNode(..) call.

samtebbs accepted this revision.Dec 14 2021, 3:20 AM

Perfect, LGTM

This revision is now accepted and ready to land.Dec 14 2021, 3:20 AM
This revision was automatically updated to reflect the committed changes.