[llvm] r239497 - change assert that will never fire to llvm_unreachable

David Blaikie dblaikie at gmail.com
Thu Jun 11 10:21:28 PDT 2015


On Wed, Jun 10, 2015 at 4:27 PM, Sanjay Patel <spatel at rotateright.com>
wrote:

> Author: spatel
> Date: Wed Jun 10 18:27:33 2015
> New Revision: 239497
>
> URL: http://llvm.org/viewvc/llvm-project?rev=239497&view=rev
> Log:
> change assert that will never fire to llvm_unreachable
>
> Modified:
>     llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
>
> Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=239497&r1=239496&r2=239497&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Wed Jun 10 18:27:33 2015
> @@ -6424,7 +6424,7 @@ void X86InstrInfo::genAlternativeCodeSeq
>             Pattern == MachineCombinerPattern::MC_REASSOC_XA_YB)
>      Prev = MRI.getUniqueVRegDef(Root.getOperand(2).getReg());
>    else
> -    assert("Unknown pattern for machine combiner");
> +    llvm_unreachable("Unknown pattern for machine combiner");
>

Generally we try not to "branch to unreachable" & instead assert whatever
the inverse of the branch condition was, so in this case:

if (AX_BY || XA_BY)
  ...
else {
  assert(AX_YB || XA_YB);
  ...
}

But sometimes it easier to read as an if/else if/else if/else
if/else-unreachable chain... *shrug*


>
>    reassociateOps(Root, *Prev, Pattern, InsInstrs, DelInstrs,
> InstIdxForVirtReg);
>    return;
>
>
> _______________________________________________
> 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/20150611/a276d773/attachment.html>


More information about the llvm-commits mailing list