This is an archive of the discontinued LLVM Phabricator instance.

[RISCV][CodeGen][SelectionDAG] Recursively check hasAllNBitUsers for logical machine opcodes
ClosedPublic

Authored by nitinjohnraj on Dec 6 2022, 2:22 PM.

Details

Summary

We don’t have W versions of AND/OR/XOR/ANDN/ORN/XNOR so we should recursively check their users. We should limit the recursion to SelectionDAG::MaxRecursionDepth levels.

We need to add a Depth argument, all existing callers should pass 0 to the Depth. The new recursive calls should increment it by 1. At the top of the function we should give up and return false if Depth >= SelectionDAG::MaxRecursionDepth.

Diff Detail

Event Timeline

nitinjohnraj created this revision.Dec 6 2022, 2:22 PM
nitinjohnraj requested review of this revision.Dec 6 2022, 2:22 PM
nitinjohnraj edited the summary of this revision. (Show Details)Dec 6 2022, 2:35 PM

This patch needs to be rebased to avoid failing the pre-merge checks.

The patch has been rebased and the test checks have been updated.

craig.topper added inline comments.Dec 13 2022, 1:06 PM
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
2284

Remove this TODO

Removed the TODO

craig.topper added inline comments.Dec 13 2022, 2:50 PM
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
2286–2287

This line is longer than 80 characters. Please run clang-format-diff

Formatting fixed

This revision is now accepted and ready to land.Dec 13 2022, 4:32 PM
This revision was landed with ongoing or failed builds.Dec 14 2022, 3:16 PM
This revision was automatically updated to reflect the committed changes.