-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[RISCV][llvm-exegesis] Add missing operand frm for FCVT_D_W #149989
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
We encountered the index of operand out of bounds crash because FCVT_D_W lacks frm operand.
@llvm/pr-subscribers-tools-llvm-exegesis Author: Jim Lin (tclin914) ChangesWe encountered the index of operand out of bounds crash because FCVT_D_W lacks frm operand. Full diff: https://github.com/llvm/llvm-project/pull/149989.diff 1 Files Affected:
diff --git a/llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp b/llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp
index 676479b3d5792..d54df2b5dc0ef 100644
--- a/llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp
+++ b/llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp
@@ -651,8 +651,10 @@ static std::vector<MCInst> loadFP64RegBits32(const MCSubtargetInfo &STI,
}
std::vector<MCInst> Instrs = loadIntReg(STI, ScratchIntReg, Bits);
- Instrs.push_back(
- MCInstBuilder(RISCV::FCVT_D_W).addReg(Reg).addReg(ScratchIntReg));
+ Instrs.push_back(MCInstBuilder(RISCV::FCVT_D_W)
+ .addReg(Reg)
+ .addReg(ScratchIntReg)
+ .addImm(7));
return Instrs;
}
|
@llvm/pr-subscribers-backend-risc-v Author: Jim Lin (tclin914) ChangesWe encountered the index of operand out of bounds crash because FCVT_D_W lacks frm operand. Full diff: https://github.com/llvm/llvm-project/pull/149989.diff 1 Files Affected:
diff --git a/llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp b/llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp
index 676479b3d5792..d54df2b5dc0ef 100644
--- a/llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp
+++ b/llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp
@@ -651,8 +651,10 @@ static std::vector<MCInst> loadFP64RegBits32(const MCSubtargetInfo &STI,
}
std::vector<MCInst> Instrs = loadIntReg(STI, ScratchIntReg, Bits);
- Instrs.push_back(
- MCInstBuilder(RISCV::FCVT_D_W).addReg(Reg).addReg(ScratchIntReg));
+ Instrs.push_back(MCInstBuilder(RISCV::FCVT_D_W)
+ .addReg(Reg)
+ .addReg(ScratchIntReg)
+ .addImm(7));
return Instrs;
}
|
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.
It looks like before this produced a malformed instruction?
I would guess that the verifier should be catching an issue like this, which means that there are two reasons (assuming I'm understanding things correctly) this wasn't caught earlier:
- There isn't test coverage in exegesis that is actually exercising this code path and running the verifier over it. In that case we should add some.
- The verifier isn't catching this. That would be weird though given this is a simple operand count mismatch and should be trivial to catch...
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.
could you add a test?
Thanks for the suggestion. I've added a test case that shows how the register setup code snippet looks to ensure the code path is verified. |
Done. Thanks. |
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. Please wait for someone with actual RISCV experience to approve before landing though.
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
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
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/187/builds/8442 Here is the relevant piece of the build log for the reference
|
We encountered the index of operand out of bounds crash because FCVT_D_W lacks frm operand.