[llvm] [RISCV] Check that the stack adjust immediate for cm.push/pop* has the correct sign and is divisible by 16. (PR #85295)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 14 12:01:00 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 2c80a9accb18f3eeb1e0c1bd09a980fb2f2dc2d5 6ff27c1f1e49b81f7b7d0d3d25544e8ac5999364 -- llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.cpp llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.cpp
index db7760f12f..04e02e9fa0 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.cpp
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.cpp
@@ -303,7 +303,8 @@ void RISCVInstPrinter::printStackAdj(const MCInst *MI, unsigned OpNo,
assert(RlistVal != 16 && "Incorrect rlist.");
auto Base = RISCVZC::getStackAdjBase(RlistVal, IsRV64, IsEABI);
StackAdj = Imm + Base;
- assert((StackAdj >= Base && StackAdj <= Base + 48) && "Incorrect stack adjust");
+ assert((StackAdj >= Base && StackAdj <= Base + 48) &&
+ "Incorrect stack adjust");
if (Negate)
StackAdj = -StackAdj;
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.h
index c444e51b5b..77cc7a67e8 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.h
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.h
@@ -52,10 +52,11 @@ public:
const MCSubtargetInfo &STI, raw_ostream &O);
void printRlist(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
raw_ostream &O);
- void printStackAdj(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
- raw_ostream &O, bool Negate = false);
- void printNegStackAdj(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
- raw_ostream &O) {
+ void printStackAdj(const MCInst *MI, unsigned OpNo,
+ const MCSubtargetInfo &STI, raw_ostream &O,
+ bool Negate = false);
+ void printNegStackAdj(const MCInst *MI, unsigned OpNo,
+ const MCSubtargetInfo &STI, raw_ostream &O) {
return printStackAdj(MI, OpNo, STI, O, /*Negate*/ true);
}
void printRegReg(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI,
``````````
</details>
https://github.com/llvm/llvm-project/pull/85295
More information about the llvm-commits
mailing list