[llvm] [SPIR-V] Add support for arbitrary precision integer constants in instruction printer (PR #185306)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 8 11:07:03 PDT 2026
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 origin/main HEAD --extensions h,cpp -- llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVInstPrinter.cpp llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVInstPrinter.h --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVInstPrinter.cpp b/llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVInstPrinter.cpp
index d01a27064..b76402599 100644
--- a/llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVInstPrinter.cpp
+++ b/llvm/lib/Target/SPIRV/MCTargetDesc/SPIRVInstPrinter.cpp
@@ -51,10 +51,11 @@ void SPIRVInstPrinter::printOpConstantVarOps(const MCInst *MI,
const unsigned NumVarOps = MI->getNumOperands() - StartIndex;
if (MI->getOpcode() == SPIRV::OpConstantI && NumVarOps > 2) {
- // Look up the actual bitwidth of this int type register from IntTypeBitwidths map
+ // Look up the actual bitwidth of this int type register from
+ // IntTypeBitwidths map
unsigned IntTypeRegId = getIDFromRegister(MI->getOperand(1).getReg().id());
auto IntTypeRegIt = IntTypeBitwidths.find(IntTypeRegId);
- if(IntTypeRegIt == IntTypeBitwidths.end()) {
+ if (IntTypeRegIt == IntTypeBitwidths.end()) {
llvm_unreachable("Int type register used before defined in OpTypeInt");
}
int Bitwidth = IntTypeRegIt->second;
@@ -133,7 +134,7 @@ void SPIRVInstPrinter::printInst(const MCInst *MI, uint64_t Address,
raw_ostream &OS) {
const unsigned OpCode = MI->getOpcode();
printInstruction(MI, Address, OS);
- if(OpCode == SPIRV::OpTypeInt) {
+ if (OpCode == SPIRV::OpTypeInt) {
recordIntType(MI);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/185306
More information about the llvm-commits
mailing list