-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[RISCV][NFCI] Use isADDLike helper for or_is_add PatFrag #81137
base: main
Are you sure you want to change the base?
Conversation
This should be equivalent.
@llvm/pr-subscribers-backend-risc-v Author: Alex Bradbury (asb) ChangesThis should be equivalent. Full diff: https://github.com/llvm/llvm-project/pull/81137.diff 1 Files Affected:
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.td b/llvm/lib/Target/RISCV/RISCVInstrInfo.td
index 518982441e7c0..aa84a4553ec1f 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.td
@@ -1249,11 +1249,7 @@ def : PatGprUimmLog2XLen<sra, SRAI>;
// Select 'or' as ADDI if the immediate bits are known to be 0 in $rs1. This
// can improve compressibility.
def or_is_add : PatFrag<(ops node:$lhs, node:$rhs), (or node:$lhs, node:$rhs),[{
- if (N->getFlags().hasDisjoint())
- return true;
- KnownBits Known0 = CurDAG->computeKnownBits(N->getOperand(0), 0);
- KnownBits Known1 = CurDAG->computeKnownBits(N->getOperand(1), 0);
- return KnownBits::haveNoCommonBitsSet(Known0, Known1);
+ return CurDAG->isADDLike(SDValue(N, 0));
}]>;
def : PatGprSimm12<or_is_add, ADDI>;
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Is it equivalent? Aren't there some special cases handled in isAddLIke? See |
Good point, I'd assumed that |
I don't have correctness concerns, just that we should have new tests. |
This should be equivalent.