[llvm] [SPIRV] Sign-extend operands of sign-sensitive ops on sub-pow2 widths (PR #203661)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 12 19:51:17 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 cpp -- llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp llvm/lib/Target/SPIRV/SPIRVPreLegalizer.cpp --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/SPIRVPreLegalizer.cpp b/llvm/lib/Target/SPIRV/SPIRVPreLegalizer.cpp
index 594e58761..f485a6b99 100644
--- a/llvm/lib/Target/SPIRV/SPIRVPreLegalizer.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVPreLegalizer.cpp
@@ -577,8 +577,8 @@ generateAssignInstrs(MachineFunction &MF, SPIRVGlobalRegistry *GR,
       case TargetOpcode::G_SREM:
         return true;
       case TargetOpcode::G_ICMP:
-        return CmpInst::isSigned(static_cast<CmpInst::Predicate>(
-            MI.getOperand(1).getPredicate()));
+        return CmpInst::isSigned(
+            static_cast<CmpInst::Predicate>(MI.getOperand(1).getPredicate()));
       default:
         return false;
       }
@@ -605,8 +605,8 @@ generateAssignInstrs(MachineFunction &MF, SPIRVGlobalRegistry *GR,
       if (!MOP.isReg())
         return;
       Register Reg = MOP.getReg();
-      auto [OWIt, OWInserted] = OrigWidth.try_emplace(
-          Reg, MRI.getType(Reg).getScalarSizeInBits());
+      auto [OWIt, OWInserted] =
+          OrigWidth.try_emplace(Reg, MRI.getType(Reg).getScalarSizeInBits());
       unsigned OldW = OWIt->second;
       unsigned NewW = widenBitWidthToNextPow2(OldW);
       if (NewW == OldW)

``````````

</details>


https://github.com/llvm/llvm-project/pull/203661


More information about the llvm-commits mailing list