Skip to content

sprinkle some llvm_unreachable for MSVC (NFC) #31310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/swift/SIL/ApplySite.h
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ class FullApplySite : public ApplySite {
case FullApplySiteKind::BeginApplyInst:
return cast<BeginApplyInst>(getInstruction())->getInoutArguments();
}
llvm_unreachable("invalid apply kind");
}

/// Returns true if \p op is the callee operand of this apply site
Expand Down
1 change: 1 addition & 0 deletions include/swift/SIL/SILDifferentiabilityWitness.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class SILDifferentiabilityWitness
case AutoDiffDerivativeFunctionKind::VJP:
return VJP;
}
llvm_unreachable("invalid derivative type");
}
void setJVP(SILFunction *jvp) { JVP = jvp; }
void setVJP(SILFunction *vjp) { VJP = vjp; }
Expand Down
1 change: 1 addition & 0 deletions include/swift/SIL/SILInstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -8107,6 +8107,7 @@ class DifferentiableFunctionInst final
case AutoDiffDerivativeFunctionKind::VJP:
return getVJPFunction();
}
llvm_unreachable("invalid derivative kind");
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ ADContext::emitNondifferentiabilityError(SourceLoc loc,
return diagnose(loc, diag::autodiff_when_differentiating_function_call);
}
}
llvm_unreachable("invalid invoker");
}

} // end namespace autodiff
Expand Down
1 change: 1 addition & 0 deletions lib/FrontendTool/FrontendTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1462,6 +1462,7 @@ static bool validateTBDIfNeeded(const CompilerInvocation &Invocation,
case FrontendOptions::TBDValidationMode::All:
return true;
}
llvm_unreachable("invalid mode");
}();

TBDGenOptions Opts = Invocation.getTBDGenOptions();
Expand Down
4 changes: 4 additions & 0 deletions lib/IRGen/GenDiffFunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class DifferentiableFuncFieldInfo final
case NormalDifferentiableFunctionTypeComponent::VJP:
return "vjp";
}
llvm_unreachable("invalid component type");
}

SILType getType(IRGenModule &IGM, SILType t) const {
Expand Down Expand Up @@ -209,6 +210,7 @@ class LinearFuncFieldInfo final : public RecordField<LinearFuncFieldInfo> {
case LinearDifferentiableFunctionTypeComponent::Transpose:
return "transpose";
}
llvm_unreachable("invalid component type");
}

SILType getType(IRGenModule &IGM, SILType t) const {
Expand All @@ -223,6 +225,7 @@ class LinearFuncFieldInfo final : public RecordField<LinearFuncFieldInfo> {
LookUpConformanceInModule(IGM.getSwiftModule()));
return SILType::getPrimitiveObjectType(transposeTy);
}
llvm_unreachable("invalid component type");
}
};

Expand Down Expand Up @@ -321,6 +324,7 @@ class LinearFuncTypeBuilder
LookUpConformanceInModule(IGM.getSwiftModule()));
return SILType::getPrimitiveObjectType(transposeTy);
}
llvm_unreachable("invalid component type");
}

StructLayout performLayout(ArrayRef<const TypeInfo *> fieldTypes) {
Expand Down
1 change: 1 addition & 0 deletions lib/IRGen/GenPointerAuth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ PointerAuthEntity::getTypeDiscriminator(IRGenModule &IGM) const {
llvm_unreachable("not type discriminated");
}
}
llvm_unreachable("invalid representation");
};

auto getCoroutineYieldTypesDiscriminator = [&](CanSILFunctionType fnType) {
Expand Down
2 changes: 2 additions & 0 deletions lib/IRGen/Linking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,7 @@ bool LinkEntity::isContextDescriptor() const {
case Kind::DifferentiabilityWitness:
return false;
}
llvm_unreachable("invalid descriptor");
}

llvm::Type *LinkEntity::getDefaultDeclarationType(IRGenModule &IGM) const {
Expand Down Expand Up @@ -1088,6 +1089,7 @@ DeclContext *LinkEntity::getDeclContextForEmission() const {
case Kind::DifferentiabilityWitness:
return nullptr;
}
llvm_unreachable("invalid decl kind");
}

bool LinkEntity::isAlwaysSharedLinkage() const {
Expand Down
1 change: 1 addition & 0 deletions lib/SIL/IR/AbstractionPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,7 @@ const {

return AbstractionPattern(getGenericSignature(), memberTy);
}
llvm_unreachable("invalid abstraction pattern kind");
}

AbstractionPattern AbstractionPattern::getAutoDiffDerivativeFunctionType(
Expand Down
1 change: 1 addition & 0 deletions lib/SIL/IR/SILInstructions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,7 @@ getExtracteeType(
LookUpConformanceInModule(module.getSwiftModule()));
return SILType::getPrimitiveObjectType(transposeFnTy);
}
llvm_unreachable("invalid extractee");
}

LinearFunctionExtractInst::LinearFunctionExtractInst(
Expand Down
1 change: 1 addition & 0 deletions lib/SIL/IR/SILProfiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ static Stmt *getProfilerStmtForCase(CaseStmt *caseStmt) {
case CaseParentKind::DoCatch:
return caseStmt->getBody();
}
llvm_unreachable("invalid parent kind");
}

/// Check that the input AST has at least been type-checked.
Expand Down
1 change: 1 addition & 0 deletions lib/SILOptimizer/Analysis/MemoryBehavior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class MemoryBehaviorVisitor

return MemBehavior::MayWrite;
}
llvm_unreachable("invalid access kind");
}

MemBehavior visitEndAccessInst(EndAccessInst *endAccess) {
Expand Down
1 change: 1 addition & 0 deletions lib/SILOptimizer/SILCombiner/SILCombinerMiscVisitors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,7 @@ static SILValue createValueFromAddr(SILValue addr, SILBuilder *builder,
// Just return anything not null for the dry-run.
return elems[0];
}
llvm_unreachable("invalid kind");
}

/// Simplify the following two frontend patterns:
Expand Down
1 change: 1 addition & 0 deletions lib/SILOptimizer/Utils/ConstantFolding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,7 @@ IEEESemantics getFPSemantics(BuiltinFloatType *fpType) {
case BuiltinFloatType::PPC128:
llvm_unreachable("ppc128 is not supported");
}
llvm_unreachable("invalid floating point kind");
}

/// This function, given the exponent and significand of a binary fraction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ SourceLoc DifferentiationInvoker::getLocation() const {
->getLocation()
.getSourceLoc();
}
llvm_unreachable("invalid differentation invoker kind");
}

void DifferentiationInvoker::print(llvm::raw_ostream &os) const {
Expand Down
1 change: 1 addition & 0 deletions lib/SILOptimizer/Utils/Differentiation/JVPEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ SILValue JVPEmitter::materializeTangentDirect(AdjointValue val,
case AdjointValueKind::Concrete:
return val.getConcreteValue();
}
llvm_unreachable("invalid value kind");
}

SILValue JVPEmitter::materializeTangent(AdjointValue val, SILLocation loc) {
Expand Down
3 changes: 3 additions & 0 deletions lib/SILOptimizer/Utils/Differentiation/PullbackEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1787,6 +1787,7 @@ SILValue PullbackEmitter::materializeAdjointDirect(AdjointValue val,
case AdjointValueKind::Concrete:
return val.getConcreteValue();
}
llvm_unreachable("invalid value kind");
}

SILValue PullbackEmitter::materializeAdjoint(AdjointValue val,
Expand Down Expand Up @@ -1958,6 +1959,7 @@ AdjointValue PullbackEmitter::accumulateAdjointsDirect(AdjointValue lhs,
}
}
}
llvm_unreachable("invalid LHS kind");
}

SILValue PullbackEmitter::accumulateDirect(SILValue lhs, SILValue rhs,
Expand Down Expand Up @@ -2007,6 +2009,7 @@ SILValue PullbackEmitter::accumulateDirect(SILValue lhs, SILValue rhs,
return builder.createTuple(loc, adjointTy, adjElements);
}
}
llvm_unreachable("invalid tangent space");
}

void PullbackEmitter::accumulateIndirect(SILValue resultBufAccess,
Expand Down
1 change: 1 addition & 0 deletions lib/TBDGen/TBDGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ getLinkerPlatformId(OriginallyDefinedInAttr::ActiveVersion Ver) {
case swift::PlatformKind::macCatalystApplicationExtension:
return LinkerPlatformId::macCatalyst;
}
llvm_unreachable("invalid platform kind");
}

static StringRef
Expand Down