[llvm] c5fe383 - IfConverter::MeetIfcvtSizeLimit - Fix uninitialized variable warnings. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat May 15 06:52:07 PDT 2021


Author: Simon Pilgrim
Date: 2021-05-15T14:51:54+01:00
New Revision: c5fe3839905fe466966d124fb6fc62365ea97636

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

LOG: IfConverter::MeetIfcvtSizeLimit - Fix uninitialized variable warnings. NFCI.

Ensure the duplication instruction counts are initialized to zero (even though they aren't used) to silence static analysis warnings.

Added: 
    

Modified: 
    llvm/lib/CodeGen/IfConversion.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/IfConversion.cpp b/llvm/lib/CodeGen/IfConversion.cpp
index aa489d022e16..bb89dca26c5c 100644
--- a/llvm/lib/CodeGen/IfConversion.cpp
+++ b/llvm/lib/CodeGen/IfConversion.cpp
@@ -300,7 +300,7 @@ namespace {
         MachineBasicBlock::iterator TIE = TBBInfo.BB->end();
         MachineBasicBlock::iterator FIE = FBBInfo.BB->end();
 
-        unsigned Dups1, Dups2;
+        unsigned Dups1 = 0, Dups2 = 0;
         if (!CountDuplicatedInstructions(TIB, FIB, TIE, FIE, Dups1, Dups2,
                                          *TBBInfo.BB, *FBBInfo.BB,
                                          /*SkipUnconditionalBranches*/ true))


        


More information about the llvm-commits mailing list