[LLVMdev] Why is this assertion here?

Villmow, Micah Micah.Villmow at amd.com
Thu Jul 26 11:29:19 PDT 2012


I'm trying to understand why this assertion is here.
LegalizeAction
  getCondCodeAction(ISD::CondCode CC, EVT VT) const {
    assert((unsigned)CC < array_lengthof(CondCodeActions) &&
           (unsigned)VT.getSimpleVT().SimpleTy < sizeof(CondCodeActions[0])*4 &&
           "Table isn't big enough!");
    LegalizeAction Action = (LegalizeAction)
      ((CondCodeActions[CC] >> (2*VT.getSimpleVT().SimpleTy)) & 3);
    assert(Action != Promote && "Can't promote condition code!");
    return Action;
  }

The first part of the assertion I can understand, but why is there an assertion
that there are only 32 types? in TOT LLVM if this code is called with v8f32,v2f64
or v4f64, this assert is triggered.
Shouldn't the assert be:
(unsigned)VT.getSimpleVT().SimpleTy < MVT::MAX_ALLOWED_VALUETYPE &&
or
(unsigned)VT.getSimpleVT().SimpleTy < MVT::LAST_VECTOR_VALUETYPE &&
?

Thanks,
Micah


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120726/ffcb2cf9/attachment.html>


More information about the llvm-dev mailing list