[llvm] r185243 - Change assert(0 && "text") to llvm_unreachable(0 && "text")

David Blaikie dblaikie at gmail.com
Fri Jun 28 18:31:41 PDT 2013


On Jun 28, 2013 4:49 PM, "Richard Trieu" <rtrieu at google.com> wrote:
>
> Author: rtrieu
> Date: Fri Jun 28 18:46:19 2013
> New Revision: 185243
>
> URL: http://llvm.org/viewvc/llvm-project?rev=185243&view=rev
> Log:
> Change assert(0 && "text") to llvm_unreachable(0 && "text")
>
> Modified:
>     llvm/trunk/lib/Target/Hexagon/InstPrinter/HexagonInstPrinter.cpp
>
> Modified: llvm/trunk/lib/Target/Hexagon/InstPrinter/HexagonInstPrinter.cpp
> URL:
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/InstPrinter/HexagonInstPrinter.cpp?rev=185243&r1=185242&r2=185243&view=diff
>
==============================================================================
> --- llvm/trunk/lib/Target/Hexagon/InstPrinter/HexagonInstPrinter.cpp
(original)
> +++ llvm/trunk/lib/Target/Hexagon/InstPrinter/HexagonInstPrinter.cpp Fri
Jun 28 18:46:19 2013
> @@ -179,7 +179,7 @@ void HexagonInstPrinter::printBranchOper
>                                              raw_ostream &O) const {
>    // Branches can take an immediate operand.  This is used by the branch
>    // selection pass to print $+8, an eight byte displacement from the PC.
> -  assert(0 && "Unknown branch operand.");
> +  llvm_unreachable("Unknown branch operand.");
>  }
>
>  void HexagonInstPrinter::printCallOperand(const MCInst *MI, unsigned
OpNo,
> @@ -203,7 +203,7 @@ void HexagonInstPrinter::printSymbol(con
>      O << '#';
>      printOperand(MI, OpNo, O);
>    } else {
> -    assert(0 && "Unknown symbol operand");
> +    llvm_unreachable("Unknown symbol operand");

This one should be able to be pushed up into an assert on whatever
condition was attached to the 'if for which this is an 'else' (& drop the
'if/else' and the unreachable print here)

>      printOperand(MI, OpNo, O);
>    }
>    O << ')';
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130628/7e3570a2/attachment.html>


More information about the llvm-commits mailing list