[llvm] b1a633b - [NFC][NVPTX] remove truncating c-style cast (#85889)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 16:39:36 PDT 2024


Author: Alex MacLean
Date: 2024-03-26T16:39:32-07:00
New Revision: b1a633bc014a845a58f0f3c4e442219051646c19

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

LOG: [NFC][NVPTX] remove truncating c-style cast (#85889)

While a stack size large enough to cause this truncation to be a problem
would certainly cause other issues and not produce a valid program
anyway, this cast is triggering our Coverity static analysis. Removing
it seems cleaner.

Added: 
    

Modified: 
    llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
index 2783b1e0ec73eb..ece9821a2d0d9f 100644
--- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -1719,7 +1719,7 @@ void NVPTXAsmPrinter::setAndEmitFunctionVirtualRegisters(
 
   // Emit the Fake Stack Object
   const MachineFrameInfo &MFI = MF.getFrameInfo();
-  int NumBytes = (int) MFI.getStackSize();
+  int64_t NumBytes = MFI.getStackSize();
   if (NumBytes) {
     O << "\t.local .align " << MFI.getMaxAlign().value() << " .b8 \t"
       << DEPOTNAME << getFunctionNumber() << "[" << NumBytes << "];\n";


        


More information about the llvm-commits mailing list