Skip to content

Commit

Permalink
Revert "[Coverity] Fix explicit null dereferences"
Browse files Browse the repository at this point in the history
This reverts commit 22b23a5.

This commit caused the following two build bots to start failing:
https://lab.llvm.org/buildbot/#/builders/216/builds/20322
https://lab.llvm.org/buildbot/#/builders/123/builds/18511
  • Loading branch information
Tom Weaver authored and Tom Weaver committed Apr 24, 2023
1 parent cd5c4cb commit b63c08c
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 13 deletions.
1 change: 0 additions & 1 deletion llvm/include/llvm/ADT/SparseSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ class SparseSet {
///
iterator findIndex(unsigned Idx) {
assert(Idx < Universe && "Key out of range");
assert(Sparse != nullptr && "Invalid sparse type");
const unsigned Stride = std::numeric_limits<SparseT>::max() + 1u;
for (unsigned i = Sparse[Idx], e = size(); i < e; i += Stride) {
const unsigned FoundIdx = ValIndexOf(Dense[i]);
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/CodeGen/PBQP/CostAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ template <typename ValueT> class ValuePool {

auto P = std::make_shared<PoolEntry>(*this, std::move(ValueKey));
EntrySet.insert(P.get());
return PoolRef(P, &P->getValue());
return PoolRef(std::move(P), &P->getValue());
}
};

Expand Down
1 change: 0 additions & 1 deletion llvm/include/llvm/CodeGen/SelectionDAGNodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,6 @@ inline SDValue::SDValue(SDNode *node, unsigned resno)
}

inline unsigned SDValue::getOpcode() const {
assert(Node != nullptr && "Invalid Node");
return Node->getOpcode();
}

Expand Down
1 change: 0 additions & 1 deletion llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,6 @@ AsmPrinter::getFunctionCFISectionType(const Function &F) const {
F.needsUnwindTableEntry())
return CFISection::EH;

assert(MMI != nullptr && "Invalid machine module info");
if (MMI->hasDebugInfo() || TM.Options.ForceDwarfFrameSection)
return CFISection::Debug;

Expand Down
2 changes: 0 additions & 2 deletions llvm/lib/CodeGen/ScheduleDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,6 @@ void ScheduleDAGTopologicalSort::AddSUnitWithoutPredecessors(const SUnit *SU) {

bool ScheduleDAGTopologicalSort::IsReachable(const SUnit *SU,
const SUnit *TargetSU) {
assert(TargetSU != nullptr && "Invalid target SUnit");
assert(SU != nullptr && "Invalid SUnit");
FixOrder();
// If insertion of the edge SU->TargetSU would create a cycle
// then there is a path from TargetSU to SU.
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/CodeGen/ValueTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,6 @@ Type *EVT::getTypeForEVT(LLVMContext &Context) const {
/// pointers as MVT::iPTR. If HandleUnknown is true, unknown types are returned
/// as Other, otherwise they are invalid.
MVT MVT::getVT(Type *Ty, bool HandleUnknown){
assert(Ty != nullptr && "Invalid type");
switch (Ty->getTypeID()) {
default:
if (HandleUnknown) return MVT(MVT::Other);
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/IR/Mangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ static void addByteCountSuffix(raw_ostream &OS, const Function *F,
void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
bool CannotUsePrivateLabel) const {
ManglerPrefixTy PrefixTy = Default;
assert(GV != nullptr && "Invalid Global Value");
if (GV->hasPrivateLinkage()) {
if (CannotUsePrivateLabel)
PrefixTy = LinkerPrivate;
Expand Down
3 changes: 0 additions & 3 deletions llvm/lib/TableGen/Record.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,8 @@ RecTy *llvm::resolveTypes(RecTy *T1, RecTy *T2) {
return resolveRecordTypes(RecTy1, RecTy2);
}

assert(T1 != nullptr && "Invalid record type");
if (T1->typeIsConvertibleTo(T2))
return T2;

assert(T2 != nullptr && "Invalid record type");
if (T2->typeIsConvertibleTo(T1))
return T1;

Expand Down
1 change: 0 additions & 1 deletion llvm/lib/Target/X86/X86InstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3603,7 +3603,6 @@ static unsigned getLoadStoreRegOpcode(Register Reg,
bool HasAVX512 = STI.hasAVX512();
bool HasVLX = STI.hasVLX();

assert(RC != nullptr && "Invalid target register class");
switch (STI.getRegisterInfo()->getSpillSize(*RC)) {
default:
llvm_unreachable("Unknown spill size");
Expand Down
1 change: 0 additions & 1 deletion llvm/utils/TableGen/GlobalISelEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3958,7 +3958,6 @@ Expected<InstructionMatcher &> GlobalISelEmitter::addBuiltinPredicates(
}
}

assert(SrcGIEquivOrNull != nullptr && "Invalid SrcGIEquivOrNull value");
// No check required. We already did it by swapping the opcode.
if (!SrcGIEquivOrNull->isValueUnset("IfSignExtend") &&
Predicate.isSignExtLoad())
Expand Down

0 comments on commit b63c08c

Please sign in to comment.