@@ -2629,9 +2629,7 @@ void Verifier::verifyInlineAsmCall(const CallBase &Call) {
26292629
26302630// / Verify that statepoint intrinsic is well formed.
26312631void Verifier::verifyStatepoint (const CallBase &Call) {
2632- assert (Call.getCalledFunction () &&
2633- Call.getCalledFunction ()->getIntrinsicID () ==
2634- Intrinsic::experimental_gc_statepoint);
2632+ assert (Call.getIntrinsicID () == Intrinsic::experimental_gc_statepoint);
26352633
26362634 Check (!Call.doesNotAccessMemory () && !Call.onlyReadsMemory () &&
26372635 !Call.onlyAccessesArgMemory (),
@@ -3635,8 +3633,7 @@ void Verifier::visitCallBase(CallBase &Call) {
36353633 }
36363634
36373635 if (Attrs.hasFnAttr (Attribute::Preallocated)) {
3638- Check (Call.getCalledFunction ()->getIntrinsicID () ==
3639- Intrinsic::call_preallocated_arg,
3636+ Check (Call.getIntrinsicID () == Intrinsic::call_preallocated_arg,
36403637 " preallocated as a call site attribute can only be on "
36413638 " llvm.call.preallocated.arg" );
36423639 }
@@ -3734,9 +3731,7 @@ void Verifier::visitCallBase(CallBase &Call) {
37343731
37353732 // Statepoint intrinsic is vararg but the wrapped function may be not.
37363733 // Allow sret here and check the wrapped function in verifyStatepoint.
3737- if (!Call.getCalledFunction () ||
3738- Call.getCalledFunction ()->getIntrinsicID () !=
3739- Intrinsic::experimental_gc_statepoint)
3734+ if (Call.getIntrinsicID () != Intrinsic::experimental_gc_statepoint)
37403735 Check (!ArgAttrs.hasAttribute (Attribute::StructRet),
37413736 " Attribute 'sret' cannot be used for vararg call arguments!" ,
37423737 Call);
@@ -3765,9 +3760,8 @@ void Verifier::visitCallBase(CallBase &Call) {
37653760 " Return type cannot be x86_amx for indirect call!" );
37663761 }
37673762
3768- if (Function *F = Call.getCalledFunction ())
3769- if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID ())
3770- visitIntrinsicCall (ID, Call);
3763+ if (Intrinsic::ID ID = Call.getIntrinsicID ())
3764+ visitIntrinsicCall (ID, Call);
37713765
37723766 // Verify that a callsite has at most one "deopt", at most one "funclet", at
37733767 // most one "gc-transition", at most one "cfguardtarget", at most one
@@ -3980,7 +3974,7 @@ void Verifier::verifyMustTailCall(CallInst &CI) {
39803974 // - The caller and callee prototypes must match. Pointer types of
39813975 // parameters or return types may differ in pointee type, but not
39823976 // address space.
3983- if (!CI.getCalledFunction () || !CI. getCalledFunction ()-> isIntrinsic ()) {
3977+ if (!CI.getIntrinsicID ()) {
39843978 Check (CallerTy->getNumParams () == CalleeTy->getNumParams (),
39853979 " cannot guarantee tail call due to mismatched parameter counts" , &CI);
39863980 for (unsigned I = 0 , E = CallerTy->getNumParams (); I != E; ++I) {
@@ -5647,8 +5641,8 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
56475641 auto *UseCall = dyn_cast<CallBase>(U);
56485642 Check (UseCall != nullptr ,
56495643 " Uses of llvm.call.preallocated.setup must be calls" );
5650- const Function *Fn = UseCall->getCalledFunction ();
5651- if (Fn && Fn-> getIntrinsicID () == Intrinsic::call_preallocated_arg) {
5644+ Intrinsic::ID IID = UseCall->getIntrinsicID ();
5645+ if (IID == Intrinsic::call_preallocated_arg) {
56525646 auto *AllocArgIndex = dyn_cast<ConstantInt>(UseCall->getArgOperand (1 ));
56535647 Check (AllocArgIndex != nullptr ,
56545648 " llvm.call.preallocated.alloc arg index must be a constant" );
@@ -5658,8 +5652,7 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
56585652 " llvm.call.preallocated.alloc arg index must be between 0 and "
56595653 " corresponding "
56605654 " llvm.call.preallocated.setup's argument count" );
5661- } else if (Fn && Fn->getIntrinsicID () ==
5662- Intrinsic::call_preallocated_teardown) {
5655+ } else if (IID == Intrinsic::call_preallocated_teardown) {
56635656 // nothing to do
56645657 } else {
56655658 Check (!FoundCall, " Can have at most one call corresponding to a "
@@ -5700,8 +5693,8 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
57005693 }
57015694 case Intrinsic::call_preallocated_arg: {
57025695 auto *Token = dyn_cast<CallBase>(Call.getArgOperand (0 ));
5703- Check (Token && Token-> getCalledFunction ()-> getIntrinsicID () ==
5704- Intrinsic::call_preallocated_setup,
5696+ Check (Token &&
5697+ Token-> getIntrinsicID () == Intrinsic::call_preallocated_setup,
57055698 " llvm.call.preallocated.arg token argument must be a "
57065699 " llvm.call.preallocated.setup" );
57075700 Check (Call.hasFnAttr (Attribute::Preallocated),
@@ -5711,8 +5704,8 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
57115704 }
57125705 case Intrinsic::call_preallocated_teardown: {
57135706 auto *Token = dyn_cast<CallBase>(Call.getArgOperand (0 ));
5714- Check (Token && Token-> getCalledFunction ()-> getIntrinsicID () ==
5715- Intrinsic::call_preallocated_setup,
5707+ Check (Token &&
5708+ Token-> getIntrinsicID () == Intrinsic::call_preallocated_setup,
57165709 " llvm.call.preallocated.teardown token argument must be a "
57175710 " llvm.call.preallocated.setup" );
57185711 break ;
@@ -5804,11 +5797,8 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
58045797
58055798 // Are we tied to a statepoint properly?
58065799 const auto *StatepointCall = dyn_cast<CallBase>(Statepoint);
5807- const Function *StatepointFn =
5808- StatepointCall ? StatepointCall->getCalledFunction () : nullptr ;
5809- Check (StatepointFn && StatepointFn->isDeclaration () &&
5810- StatepointFn->getIntrinsicID () ==
5811- Intrinsic::experimental_gc_statepoint,
5800+ Check (StatepointCall && StatepointCall->getIntrinsicID () ==
5801+ Intrinsic::experimental_gc_statepoint,
58125802 " gc.result operand #1 must be from a statepoint" , Call,
58135803 Call.getArgOperand (0 ));
58145804
0 commit comments