[llvm] [DirectX] add maybe_unused to IsVolatile in legalizeMemCpy. (PR #143040)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 5 15:38:56 PDT 2025


https://github.com/farzonl created https://github.com/llvm/llvm-project/pull/143040

fixes a warning when building release.

>From 40d5ee04c929efb6c58a5a280fcb47208ca7d3a2 Mon Sep 17 00:00:00 2001
From: Farzon Lotfi <farzonlotfi at microsoft.com>
Date: Thu, 5 Jun 2025 18:37:28 -0400
Subject: [PATCH] [DirectX] add maybe_unused to IsVolatile in legalizeMemCpy.

---
 llvm/lib/Target/DirectX/DXILLegalizePass.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Target/DirectX/DXILLegalizePass.cpp b/llvm/lib/Target/DirectX/DXILLegalizePass.cpp
index 79b0cf261ba31..85a4631119b9e 100644
--- a/llvm/lib/Target/DirectX/DXILLegalizePass.cpp
+++ b/llvm/lib/Target/DirectX/DXILLegalizePass.cpp
@@ -470,7 +470,7 @@ static void legalizeMemCpy(Instruction &I,
   Value *Src = CI->getArgOperand(1);
   ConstantInt *Length = dyn_cast<ConstantInt>(CI->getArgOperand(2));
   assert(Length && "Expected Length to be a ConstantInt");
-  ConstantInt *IsVolatile = dyn_cast<ConstantInt>(CI->getArgOperand(3));
+  [[maybe_unused]] ConstantInt *IsVolatile = dyn_cast<ConstantInt>(CI->getArgOperand(3));
   assert(IsVolatile && "Expected IsVolatile to be a ConstantInt");
   assert(IsVolatile->getZExtValue() == 0 && "Expected IsVolatile to be false");
   emitMemcpyExpansion(Builder, Dst, Src, Length);



More information about the llvm-commits mailing list