[llvm] [GlobalISel] Catching inconsistencies in load memory, result, and range metadata type (PR #121247)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 6 08:02:17 PST 2025
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 9a95c097d0466c594f40a4ba9ced8a155574fdff b740e226c762079223b9aab6f5457d15a61f8ce8 --extensions cpp -- llvm/lib/CodeGen/MachineVerifier.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp
index 5a02fde638..d484c6811d 100644
--- a/llvm/lib/CodeGen/MachineVerifier.cpp
+++ b/llvm/lib/CodeGen/MachineVerifier.cpp
@@ -1277,17 +1277,19 @@ void MachineVerifier::verifyPreISelGenericInstruction(const MachineInstr *MI) {
if (MMO.getRanges()) {
auto operandBits = [](const MDOperand &o) -> unsigned {
- ConstantInt *i = mdconst::dyn_extract<ConstantInt>(o);
- if (!i->isNegative()) return i->getValue().getActiveBits();
+ ConstantInt *i = mdconst::dyn_extract<ConstantInt>(o);
+ if (!i->isNegative())
+ return i->getValue().getActiveBits();
APInt reversed(i->getValue());
reversed.negate();
return reversed.getActiveBits() + 1; // one more bit for the sign
};
- unsigned bitsUsed = std::max(operandBits(MMO.getRanges()->getOperand(0)),
- operandBits(MMO.getRanges()->getOperand(1)));
+ unsigned bitsUsed =
+ std::max(operandBits(MMO.getRanges()->getOperand(0)),
+ operandBits(MMO.getRanges()->getOperand(1)));
if (bitsUsed != ValTy.getScalarType().getSizeInBits()) {
- report("range is incompatible with the value it gets assigned to",
- MI);
+ report("range is incompatible with the value it gets assigned to",
+ MI);
}
}
} else if (MI->getOpcode() == TargetOpcode::G_STORE) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/121247
More information about the llvm-commits
mailing list