@@ -2629,9 +2629,7 @@ void Verifier::verifyInlineAsmCall(const CallBase &Call) {
2629
2629
2630
2630
// / Verify that statepoint intrinsic is well formed.
2631
2631
void 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);
2635
2633
2636
2634
Check (!Call.doesNotAccessMemory () && !Call.onlyReadsMemory () &&
2637
2635
!Call.onlyAccessesArgMemory (),
@@ -3635,8 +3633,7 @@ void Verifier::visitCallBase(CallBase &Call) {
3635
3633
}
3636
3634
3637
3635
if (Attrs.hasFnAttr (Attribute::Preallocated)) {
3638
- Check (Call.getCalledFunction ()->getIntrinsicID () ==
3639
- Intrinsic::call_preallocated_arg,
3636
+ Check (Call.getIntrinsicID () == Intrinsic::call_preallocated_arg,
3640
3637
" preallocated as a call site attribute can only be on "
3641
3638
" llvm.call.preallocated.arg" );
3642
3639
}
@@ -3734,9 +3731,7 @@ void Verifier::visitCallBase(CallBase &Call) {
3734
3731
3735
3732
// Statepoint intrinsic is vararg but the wrapped function may be not.
3736
3733
// 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)
3740
3735
Check (!ArgAttrs.hasAttribute (Attribute::StructRet),
3741
3736
" Attribute 'sret' cannot be used for vararg call arguments!" ,
3742
3737
Call);
@@ -3765,9 +3760,8 @@ void Verifier::visitCallBase(CallBase &Call) {
3765
3760
" Return type cannot be x86_amx for indirect call!" );
3766
3761
}
3767
3762
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);
3771
3765
3772
3766
// Verify that a callsite has at most one "deopt", at most one "funclet", at
3773
3767
// most one "gc-transition", at most one "cfguardtarget", at most one
@@ -3980,7 +3974,7 @@ void Verifier::verifyMustTailCall(CallInst &CI) {
3980
3974
// - The caller and callee prototypes must match. Pointer types of
3981
3975
// parameters or return types may differ in pointee type, but not
3982
3976
// address space.
3983
- if (!CI.getCalledFunction () || !CI. getCalledFunction ()-> isIntrinsic ()) {
3977
+ if (!CI.getIntrinsicID ()) {
3984
3978
Check (CallerTy->getNumParams () == CalleeTy->getNumParams (),
3985
3979
" cannot guarantee tail call due to mismatched parameter counts" , &CI);
3986
3980
for (unsigned I = 0 , E = CallerTy->getNumParams (); I != E; ++I) {
@@ -5647,8 +5641,8 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
5647
5641
auto *UseCall = dyn_cast<CallBase>(U);
5648
5642
Check (UseCall != nullptr ,
5649
5643
" 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) {
5652
5646
auto *AllocArgIndex = dyn_cast<ConstantInt>(UseCall->getArgOperand (1 ));
5653
5647
Check (AllocArgIndex != nullptr ,
5654
5648
" llvm.call.preallocated.alloc arg index must be a constant" );
@@ -5658,8 +5652,7 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
5658
5652
" llvm.call.preallocated.alloc arg index must be between 0 and "
5659
5653
" corresponding "
5660
5654
" 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) {
5663
5656
// nothing to do
5664
5657
} else {
5665
5658
Check (!FoundCall, " Can have at most one call corresponding to a "
@@ -5700,8 +5693,8 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
5700
5693
}
5701
5694
case Intrinsic::call_preallocated_arg: {
5702
5695
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,
5705
5698
" llvm.call.preallocated.arg token argument must be a "
5706
5699
" llvm.call.preallocated.setup" );
5707
5700
Check (Call.hasFnAttr (Attribute::Preallocated),
@@ -5711,8 +5704,8 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
5711
5704
}
5712
5705
case Intrinsic::call_preallocated_teardown: {
5713
5706
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,
5716
5709
" llvm.call.preallocated.teardown token argument must be a "
5717
5710
" llvm.call.preallocated.setup" );
5718
5711
break ;
@@ -5804,11 +5797,8 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
5804
5797
5805
5798
// Are we tied to a statepoint properly?
5806
5799
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,
5812
5802
" gc.result operand #1 must be from a statepoint" , Call,
5813
5803
Call.getArgOperand (0 ));
5814
5804
0 commit comments