[llvm] 296af38 - [NFC][LV] Fix warning of unused SubConst variable

Samuel Tebbs via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 30 07:47:00 PDT 2025


Author: Samuel Tebbs
Date: 2025-09-30T15:53:40+01:00
New Revision: 296af382c814539348b2aac797e73169355c5b8c

URL: https://github.com/llvm/llvm-project/commit/296af382c814539348b2aac797e73169355c5b8c
DIFF: https://github.com/llvm/llvm-project/commit/296af382c814539348b2aac797e73169355c5b8c.diff

LOG: [NFC][LV] Fix warning of unused SubConst variable

https://github.com/llvm/llvm-project/pull/160154 added an assertion
using a new variable, which caused a warning in builds without asserts.
This patch adds [[maybe_unused]] to prevent that warning.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlan.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 4c7a083e0d9b7..10d704df289c8 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -3033,7 +3033,7 @@ class VPExpressionRecipe : public VPSingleDefRecipe {
     assert(Red->getRecurrenceKind() == RecurKind::Add &&
            "Expected an add reduction");
     assert(getNumOperands() >= 3 && "Expected at least three operands");
-    auto *SubConst = dyn_cast<ConstantInt>(getOperand(2)->getLiveInIRValue());
+    [[maybe_unused]] auto *SubConst = dyn_cast<ConstantInt>(getOperand(2)->getLiveInIRValue());
     assert(SubConst && SubConst->getValue() == 0 &&
            Sub->getOpcode() == Instruction::Sub && "Expected a negating sub");
   }


        


More information about the llvm-commits mailing list