[llvm-branch-commits] [llvm] 752fafd - [NFC] Fix -Wsometimes-uninitialized

Jordan Rupprecht via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jan 13 20:38:21 PST 2021


Author: Jordan Rupprecht
Date: 2021-01-13T20:32:38-08:00
New Revision: 752fafda3dbf1f4885c64408a13ddb67c91ccb13

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

LOG: [NFC] Fix -Wsometimes-uninitialized

After 49142991a685bd427d7e877c29c77371dfb7634c, clang detects that MUL may be uninitialized. Set it to nullptr to suppress this check.

Adding an assert to check that it is ultimately set fails two test cases. Since this is not a new issue, leave the assertion commented out until a code owner can fix the bug. The two failing test cases are noted in the assertion comment.

Added: 
    

Modified: 
    llvm/lib/Target/AArch64/AArch64InstrInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
index 888d3c113c91..6b38e216a854 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
@@ -4871,7 +4871,7 @@ void AArch64InstrInfo::genAlternativeCodeSequence(
   MachineFunction &MF = *MBB.getParent();
   const TargetInstrInfo *TII = MF.getSubtarget().getInstrInfo();
 
-  MachineInstr *MUL;
+  MachineInstr *MUL = nullptr;
   const TargetRegisterClass *RC;
   unsigned Opc;
   switch (Pattern) {
@@ -5692,6 +5692,9 @@ void AArch64InstrInfo::genAlternativeCodeSequence(
   }
   } // end switch (Pattern)
   // Record MUL and ADD/SUB for deletion
+  // FIXME: This assertion fails in CodeGen/AArch64/tailmerging_in_mbp.ll and
+  // CodeGen/AArch64/urem-seteq-nonzero.ll.
+  // assert(MUL && "MUL was never set");
   DelInstrs.push_back(MUL);
   DelInstrs.push_back(&Root);
 }


        


More information about the llvm-branch-commits mailing list