This is an archive of the discontinued LLVM Phabricator instance.

[lanai] Add computeKnownBitsForTargetNode for Lanai.
ClosedPublic

Authored by jpienaar on Feb 6 2017, 1:47 PM.

Details

Summary

computeKnownBitsForTargetNode was not defined for Lanai which resulted in additional AND's with 0x1 for the output of SETCC instructions.

Event Timeline

jpienaar created this revision.Feb 6 2017, 1:47 PM
majnemer edited edge metadata.Feb 6 2017, 1:53 PM

Hmm, this is the sort of thing I'd expect SelectionDAG to "just do"... Do other backends achieve the same end by similar means?

Hmm, this is the sort of thing I'd expect SelectionDAG to "just do"... Do other backends achieve the same end by similar means?

I'd expect this logic to zap away such an AND: https://github.com/llvm-mirror/llvm/blob/fb21e4d6fc9ff15b231354be4068c3f732deee02/lib/CodeGen/SelectionDAG/TargetLowering.cpp#L560

jpienaar updated this revision to Diff 97268.May 1 2017, 12:53 AM

Add computeKnownBitsForTargetNode for Lanai.

jpienaar retitled this revision from [lanai] Avoid unnecessary AND'ing for brcond. to [lanai] Add computeKnownBitsForTargetNode for Lanai..May 1 2017, 12:54 AM
jpienaar edited the summary of this revision. (Show Details)

Hmm, this is the sort of thing I'd expect SelectionDAG to "just do"... Do other backends achieve the same end by similar means?

Yes, PPC does it in PPCTargetLowering::DAGCombineTruncBoolExt (https://github.com/llvm-mirror/llvm/blob/fb21e4d6fc9ff15b231354be4068c3f732deee02/lib/Target/PowerPC/PPCISelLowering.cpp#L9979) but in retrospect they were doing it as they have 2 different ways of setting conditional flags. For Lanai this was not needed.

I'd expect this logic to zap away such an AND: https://github.com/llvm-mirror/llvm/blob/fb21e4d6fc9ff15b231354be4068c3f732deee02/lib/CodeGen/SelectionDAG/TargetLowering.cpp#L560

This was good suggestion: it let me to seeing that computeKnownBitsForTargetNode was not defined for Lanai and so this combination would not happen. So the resulting change is much simpler and covers more cases.

majnemer accepted this revision.May 1 2017, 8:33 AM

LGTM

This revision is now accepted and ready to land.May 1 2017, 8:33 AM
jpienaar closed this revision.May 9 2017, 11:48 AM