[RISCV] Use getCopyFromReg in unit test to match comment. NFC - #183199
Merged
Merged
Conversation
Using a physical register 0 also just look suspicious.
Member
|
@llvm/pr-subscribers-backend-risc-v Author: Craig Topper (topperc) ChangesUsing physical register 0, aka NoRegister, also just looked suspicious. Full diff: https://github.com/llvm/llvm-project/pull/183199.diff 1 Files Affected:
diff --git a/llvm/unittests/Target/RISCV/RISCVSelectionDAGTest.cpp b/llvm/unittests/Target/RISCV/RISCVSelectionDAGTest.cpp
index 9c61aae358278..31c36fa5261ab 100644
--- a/llvm/unittests/Target/RISCV/RISCVSelectionDAGTest.cpp
+++ b/llvm/unittests/Target/RISCV/RISCVSelectionDAGTest.cpp
@@ -102,10 +102,12 @@ TEST_F(RISCVSelectionDAGTest, computeKnownBits_SRLW) {
// The DAG created below is derived from this
SDLoc Loc;
auto Int64VT = EVT::getIntegerVT(Context, 64);
- auto Px = DAG->getRegister(0, Int64VT);
+ auto Px = DAG->getCopyFromReg(DAG->getEntryNode(), Loc,
+ Register::index2VirtReg(0), Int64VT);
auto Py = DAG->getConstant(2147483647, Loc, Int64VT);
auto N1 = DAG->getNode(ISD::AND, Loc, Int64VT, Px, Py);
- auto Qx = DAG->getRegister(0, Int64VT);
+ auto Qx = DAG->getCopyFromReg(DAG->getEntryNode(), Loc,
+ Register::index2VirtReg(1), Int64VT);
auto N2 = DAG->getNode(RISCVISD::SRLW, Loc, Int64VT, N1, Qx);
auto Py2 = DAG->getConstant(4294967295, Loc, Int64VT);
auto N3 = DAG->getNode(ISD::AND, Loc, Int64VT, N2, Py2);
|
topperc
commented
Feb 24, 2026
| SDLoc Loc; | ||
| auto Int64VT = EVT::getIntegerVT(Context, 64); | ||
| auto Px = DAG->getRegister(0, Int64VT); | ||
| auto Px = DAG->getCopyFromReg(DAG->getEntryNode(), Loc, |
Contributor
Author
There was a problem hiding this comment.
The comment mentioned in the title is line 94 and line 96 above.
sujianIBM
pushed a commit
to sujianIBM/llvm-project
that referenced
this pull request
Mar 5, 2026
…83199) Using physical register 0, aka NoRegister, also just looked suspicious.
This was referenced Apr 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Using physical register 0, aka NoRegister, also just looked suspicious.