diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -7067,10 +7067,14 @@ // Sink expensive instructions into the conditional blocks to avoid executing // them speculatively. - for (Instruction *I : TrueInstrs) + for (Instruction *I : TrueInstrs) { + assert(TrueBranch != nullptr && "TrueBranch must be initialized"); I->moveBefore(TrueBranch); - for (Instruction *I : FalseInstrs) + } + for (Instruction *I : FalseInstrs) { + assert(FalseBranch != nullptr && "FalseBranch must be initialized"); I->moveBefore(FalseBranch); + } // If we did not create a new block for one of the 'true' or 'false' paths // of the condition, it means that side of the branch goes to the end block diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp --- a/llvm/lib/TableGen/TGParser.cpp +++ b/llvm/lib/TableGen/TGParser.cpp @@ -581,9 +581,11 @@ ArgName = Arg->getName(); // We can only specify the template argument once. - if (!is_contained(UnsolvedArgNames, ArgName)) + if (!is_contained(UnsolvedArgNames, ArgName)) { + assert(ArgName != nullptr && "ArgName must be initialized"); return Error(Loc, "We can only specify the template argument '" + ArgName->getAsUnquotedString() + "' once"); + } ArgValueHandler(ArgName, ArgValue); llvm::erase_value(UnsolvedArgNames, ArgName); diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -5963,6 +5963,8 @@ if (DAG.ComputeNumSignBits(Src, DemandedSrcElts) != NumBitsPerSrcElt) return false; + // Call DAG->ComputeNumSignBits(Src, DemandedSrcElts, 0U) may return 0 + assert(NumBitsPerSrcElt != 0 && "Modulo by zero"); assert((NumBitsPerElt % NumBitsPerSrcElt) == 0 && "Unexpected extension"); unsigned Scale = NumBitsPerElt / NumBitsPerSrcElt; for (unsigned I = 0; I != NumElts; ++I)