<p dir="ltr"><br>
On Oct 25, 2015 3:30 PM, "Benjamin Kramer via llvm-commits" <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
><br>
> Author: d0k<br>
> Date: Sun Oct 25 17:28:27 2015<br>
> New Revision: 251266<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=251266&view=rev">http://llvm.org/viewvc/llvm-project?rev=251266&view=rev</a><br>
> Log:<br>
> Convert assert(false) into llvm_unreachable where it makes sense.</p>
<p dir="ltr">What sort of places didn't make sense?</p>
<p dir="ltr">><br>
> Modified:<br>
> llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp<br>
> llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp<br>
> llvm/trunk/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp<br>
> llvm/trunk/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp<br>
> llvm/trunk/lib/Target/X86/X86ISelLowering.cpp<br>
> llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp<br>
><br>
> Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp?rev=251266&r1=251265&r2=251266&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp?rev=251266&r1=251265&r2=251266&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp (original)<br>
> +++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Sun Oct 25 17:28:27 2015<br>
> @@ -97,7 +97,7 @@ ARMBaseInstrInfo::ARMBaseInstrInfo(const<br>
> Subtarget(STI) {<br>
> for (unsigned i = 0, e = array_lengthof(ARM_MLxTable); i != e; ++i) {<br>
> if (!MLxEntryMap.insert(std::make_pair(ARM_MLxTable[i].MLxOpc, i)).second)<br>
> - assert(false && "Duplicated entries?");<br>
> + llvm_unreachable("Duplicated entries?");<br>
> MLxHazardOpcodes.insert(ARM_MLxTable[i].AddSubOpc);<br>
> MLxHazardOpcodes.insert(ARM_MLxTable[i].MulOpc);<br>
> }<br>
><br>
> Modified: llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp?rev=251266&r1=251265&r2=251266&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp?rev=251266&r1=251265&r2=251266&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp (original)<br>
> +++ llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp Sun Oct 25 17:28:27 2015<br>
> @@ -213,7 +213,7 @@ Thumb2SizeReduce::Thumb2SizeReduce(std::<br>
> for (unsigned i = 0, e = array_lengthof(ReduceTable); i != e; ++i) {<br>
> unsigned FromOpc = ReduceTable[i].WideOpc;<br>
> if (!ReduceOpcodeMap.insert(std::make_pair(FromOpc, i)).second)<br>
> - assert(false && "Duplicated entries?");<br>
> + llvm_unreachable("Duplicated entries?");<br>
> }<br>
> }<br>
><br>
><br>
> Modified: llvm/trunk/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp?rev=251266&r1=251265&r2=251266&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp?rev=251266&r1=251265&r2=251266&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp (original)<br>
> +++ llvm/trunk/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp Sun Oct 25 17:28:27 2015<br>
> @@ -316,8 +316,8 @@ Value *GenericToNVVM::remapConstantExpr(<br>
> NewOperands[0], NewOperands[1]);<br>
> case Instruction::FCmp:<br>
> // CompareConstantExpr (fcmp)<br>
> - assert(false && "Address space conversion should have no effect "<br>
> - "on float point CompareConstantExpr (fcmp)!");<br>
> + llvm_unreachable("Address space conversion should have no effect "<br>
> + "on float point CompareConstantExpr (fcmp)!");<br>
> return C;</p>
<p dir="ltr">Drop the unreachable return?</p>
<p dir="ltr">> case Instruction::ExtractElement:<br>
> // ExtractElementConstantExpr<br>
> @@ -362,7 +362,7 @@ Value *GenericToNVVM::remapConstantExpr(<br>
> return Builder.CreateCast(Instruction::CastOps(C->getOpcode()),<br>
> NewOperands[0], C->getType());<br>
> }<br>
> - assert(false && "GenericToNVVM encountered an unsupported ConstantExpr");<br>
> + llvm_unreachable("GenericToNVVM encountered an unsupported ConstantExpr");<br>
> return C;</p>
<p dir="ltr">And here</p>
<p dir="ltr">> }<br>
> }<br>
><br>
> Modified: llvm/trunk/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp?rev=251266&r1=251265&r2=251266&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp?rev=251266&r1=251265&r2=251266&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp (original)<br>
> +++ llvm/trunk/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp Sun Oct 25 17:28:27 2015<br>
> @@ -789,7 +789,7 @@ void PPCVSXSwapRemoval::handleSpecialSwa<br>
> switch (SwapVector[EntryIdx].SpecialHandling) {<br>
><br>
> default:<br>
> - assert(false && "Unexpected special handling type");<br>
> + llvm_unreachable("Unexpected special handling type");<br>
> break;</p>
<p dir="ltr">Unreachable break</p>
<p dir="ltr">><br>
> // For splats based on an index into a vector, add N/2 modulo N<br>
> @@ -803,7 +803,7 @@ void PPCVSXSwapRemoval::handleSpecialSwa<br>
><br>
> switch (MI->getOpcode()) {<br>
> default:<br>
> - assert(false && "Unexpected splat opcode");<br>
> + llvm_unreachable("Unexpected splat opcode");<br>
> case PPC::VSPLTB: NElts = 16; break;<br>
> case PPC::VSPLTH: NElts = 8; break;<br>
> case PPC::VSPLTW: NElts = 4; break;<br>
><br>
> Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=251266&r1=251265&r2=251266&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=251266&r1=251265&r2=251266&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)<br>
> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sun Oct 25 17:28:27 2015<br>
> @@ -10957,8 +10957,7 @@ static SDValue lower1BitVectorShuffle(SD<br>
> EVT ExtVT;<br>
> switch (VT.SimpleTy) {<br>
> default:<br>
> - assert(false && "Expected a vector of i1 elements");<br>
> - break;<br>
> + llvm_unreachable("Expected a vector of i1 elements");<br>
> case MVT::v2i1:<br>
> ExtVT = MVT::v2i64;<br>
> break;<br>
><br>
> Modified: llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp?rev=251266&r1=251265&r2=251266&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp?rev=251266&r1=251265&r2=251266&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Scalar/LoopInterchange.cpp Sun Oct 25 17:28:27 2015<br>
> @@ -996,7 +996,7 @@ void LoopInterchangeTransform::removeChi<br>
> return;<br>
> }<br>
> }<br>
> - assert(false && "Couldn't find loop");<br>
> + llvm_unreachable("Couldn't find loop");<br>
> }<br>
><br>
> void LoopInterchangeTransform::restructureLoops(Loop *InnerLoop,<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</p>