Skip to content

Conversation

maarquitos14
Copy link
Contributor

Address issues reported by a static analysis tool.

@llvmbot
Copy link
Member

llvmbot commented Sep 25, 2025

@llvm/pr-subscribers-backend-spir-v

Author: Marcos Maronas (maarquitos14)

Changes

Address issues reported by a static analysis tool.


Full diff: https://github.com/llvm/llvm-project/pull/160752.diff

1 Files Affected:

  • (modified) llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp (+3-2)
diff --git a/llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp b/llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp
index 27bb54c2d2e31..090373a03a33a 100644
--- a/llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp
@@ -584,7 +584,8 @@ bool SPIRVLegalizerInfo::legalizeIsFPClass(
   }
 
   if (FPClassTest PartialCheck = Mask & fcNan) {
-    auto InfWithQnanBitC = buildSPIRVConstant(IntTy, Inf | QNaNBitMask);
+    auto InfWithQnanBitC =
+        buildSPIRVConstant(IntTy, std::move(Inf) | QNaNBitMask);
     if (PartialCheck == fcNan) {
       // isnan(V) ==> abs(V) u> int(inf)
       appendToRes(
@@ -610,7 +611,7 @@ bool SPIRVLegalizerInfo::legalizeIsFPClass(
     APInt ExpLSB = ExpMask & ~(ExpMask.shl(1));
     auto ExpMinusOne = assignSPIRVTy(
         MIRBuilder.buildSub(IntTy, Abs, buildSPIRVConstant(IntTy, ExpLSB)));
-    APInt MaxExpMinusOne = ExpMask - ExpLSB;
+    APInt MaxExpMinusOne = std::move(ExpMask) - ExpLSB;
     auto NormalRes = assignSPIRVTy(
         MIRBuilder.buildICmp(CmpInst::Predicate::ICMP_ULT, DstTy, ExpMinusOne,
                              buildSPIRVConstant(IntTy, MaxExpMinusOne)));

@maarquitos14
Copy link
Contributor Author

Test failure is unrelated to the PR.

@maarquitos14
Copy link
Contributor Author

@MrSidims @s-perron @michalpaszkowski @Keenuts friendly ping :)

@maarquitos14
Copy link
Contributor Author

Like I said, test failure is unrelated (and being addressed in #158086), so I'm merging this.

@maarquitos14 maarquitos14 enabled auto-merge (squash) September 29, 2025 15:02
@maarquitos14 maarquitos14 merged commit 1ef1175 into llvm:main Sep 29, 2025
9 of 10 checks passed
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Oct 3, 2025
Address issues reported by a static analysis tool.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants