-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[RISCV] Added test case for PR119527. NFC #121816
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
Conversation
@llvm/pr-subscribers-backend-risc-v Author: Mikhail R. Gadelha (mikhailramalho) ChangesC2 can be null here, so we need to check it or clang may crash. Full diff: https://github.com/llvm/llvm-project/pull/121816.diff 1 Files Affected:
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 7efe3732d8be13..9acd374225505d 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -18388,7 +18388,7 @@ bool RISCVTargetLowering::isDesirableToCommuteWithShift(
auto *C2 = dyn_cast<ConstantSDNode>(N->getOperand(1));
// Bail if we might break a sh{1,2,3}add pattern.
- if (Subtarget.hasStdExtZba() && C2->getZExtValue() >= 1 &&
+ if (Subtarget.hasStdExtZba() && C2 && C2->getZExtValue() >= 1 &&
C2->getZExtValue() <= 3 && N->hasOneUse() &&
N->user_begin()->getOpcode() == ISD::ADD &&
!isUsedByLdSt(*N->user_begin(), nullptr) &&
|
creduce is running now to reduce the test case I got, I'll add the test case as soon as it's done. |
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.
Thanks, LGTM w/ Philip's comment about moving the test
Since a bunch of people were running into this crash I've cherry-picked the RISCVISelLowering.cpp changes to main in b0e05a5, but it still needs the test case from this PR |
Signed-off-by: Mikhail R. Gadelha <[email protected]>
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 again, just need to update the PR title to reflect that it's adding a test and it's NFC
Co-authored-by: Luke Lau <[email protected]>
Co-authored-by: Luke Lau <[email protected]>
Co-authored-by: Luke Lau <[email protected]>
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 w/minor comment. (I second Luke's comment on the change to description.)
C2 can be null here, so we need to check it or clang may crash.