[llvm] r279528 - Fix some more asserts after r279466.

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 12:11:29 PDT 2016


This really doesn't feel right.  These uses aren't really asking for the 
name of the intrinsic with no types; they're asking for some new notion 
of a "base name".  In particular, if really feels like a design mistake 
to allow asking for the name of a parametric intrinsic without providing 
the right number of types.

Philip

On 08/23/2016 09:23 AM, Pete Cooper via llvm-commits wrote:
> Author: pete
> Date: Tue Aug 23 11:23:45 2016
> New Revision: 279528
>
> URL: http://llvm.org/viewvc/llvm-project?rev=279528&view=rev
> Log:
> Fix some more asserts after r279466.
>
> That commit added a new version of Intrinsic::getName which should only
> be called when the intrinsic has no overloaded types.  There are several
> debugging paths, such as SDNode::dump which are printing the name of the
> intrinsic but don't have the overloaded types.  These paths should be ok
> to just print the name instead of crashing.
>
> The fix here is ultimately to just add a 'None' second argument as that
> calls the overload capable getName, which is less efficient, but this is a
> debugging path anyway, and not perf critical.
>
> Thanks to Björn Pettersson for pointing out that there were more crashes.
>
> Modified:
>      llvm/trunk/lib/CodeGen/MachineInstr.cpp
>      llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
>      llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
>
> Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=279528&r1=279527&r2=279528&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
> +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Tue Aug 23 11:23:45 2016
> @@ -470,7 +470,7 @@ void MachineOperand::print(raw_ostream &
>     case MachineOperand::MO_IntrinsicID: {
>       Intrinsic::ID ID = getIntrinsicID();
>       if (ID < Intrinsic::num_intrinsics)
> -      OS << "<intrinsic:@" << Intrinsic::getName(ID) << ')';
> +      OS << "<intrinsic:@" << Intrinsic::getName(ID, None) << ')';
>       else if (IntrinsicInfo)
>         OS << "<intrinsic:@" << IntrinsicInfo->getName(ID) << ')';
>       else
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp?rev=279528&r1=279527&r2=279528&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp Tue Aug 23 11:23:45 2016
> @@ -119,7 +119,7 @@ std::string SDNode::getOperationName(con
>       unsigned OpNo = getOpcode() == ISD::INTRINSIC_WO_CHAIN ? 0 : 1;
>       unsigned IID = cast<ConstantSDNode>(getOperand(OpNo))->getZExtValue();
>       if (IID < Intrinsic::num_intrinsics)
> -      return Intrinsic::getName((Intrinsic::ID)IID);
> +      return Intrinsic::getName((Intrinsic::ID)IID, None);
>       else if (const TargetIntrinsicInfo *TII = G->getTarget().getIntrinsicInfo())
>         return TII->getName(IID);
>       llvm_unreachable("Invalid intrinsic ID");
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=279528&r1=279527&r2=279528&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Aug 23 11:23:45 2016
> @@ -3579,7 +3579,7 @@ void SelectionDAGISel::CannotYetSelect(S
>       unsigned iid =
>         cast<ConstantSDNode>(N->getOperand(HasInputChain))->getZExtValue();
>       if (iid < Intrinsic::num_intrinsics)
> -      Msg << "intrinsic %" << Intrinsic::getName((Intrinsic::ID)iid);
> +      Msg << "intrinsic %" << Intrinsic::getName((Intrinsic::ID)iid, None);
>       else if (const TargetIntrinsicInfo *TII = TM.getIntrinsicInfo())
>         Msg << "target intrinsic %" << TII->getName(iid);
>       else
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list