Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AIG] Add LowerVariadic and LowerWordToBits passes #7739

Merged
merged 2 commits into from
Oct 26, 2024

Conversation

uenoku
Copy link
Member

@uenoku uenoku commented Oct 26, 2024

This PR adds two basic legalization pass that lowers multibit variadic AndInverter to a single bit binary AndInverter. Once after these lowerings were applied it's trivial to interact with traditional AIG representation.

This PR is extracted from #7717

@uenoku uenoku force-pushed the dev/hidetou/add-lower-variadic-and-words branch from 89dce89 to 4e61009 Compare October 26, 2024 09:51
Comment on lines +52 to +64
// Reuse bits if we can extract from `comb.concat` operands.
if (auto concat = operand.getDefiningOp<comb::ConcatOp>()) {
// For the simplicity, we only handle the case where all the
// `comb.concat` operands are single-bit.
if (concat.getNumOperands() == width &&
llvm::all_of(concat.getOperandTypes(), [](Type type) {
return type.getIntOrFloatBitWidth() == 1;
})) {
// Be careful with the endianness here.
operands.push_back(concat.getOperand(width - i - 1));
continue;
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maerhart I addressed the comment #7717 (comment) here. Thank you for the suggestion!

This commit adds AIG LowerVariadic pass to lower variadic AndInverter
op to have at most two operands. This makes IR closer to traditinal
AIG representation combined with LowerWordToBits pass
This commit ads LowerWordToBits pass that perform bit-blasting for
AndInverterOp.
@uenoku uenoku force-pushed the dev/hidetou/add-lower-variadic-and-words branch from 4e61009 to 29cf976 Compare October 26, 2024 10:12
@uenoku uenoku merged commit 4f0edf4 into llvm:main Oct 26, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant