@@ -454,24 +454,14 @@ bool CallBase::paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const {
454
454
}
455
455
456
456
bool CallBase::hasFnAttrOnCalledFunction (Attribute::AttrKind Kind) const {
457
- Value *V = getCalledOperand ();
458
- if (auto *CE = dyn_cast<ConstantExpr>(V))
459
- if (CE->getOpcode () == BitCast)
460
- V = CE->getOperand (0 );
461
-
462
- if (auto *F = dyn_cast<Function>(V))
457
+ if (auto *F = dyn_cast<Function>(getCalledOperand ()))
463
458
return F->getAttributes ().hasFnAttr (Kind);
464
459
465
460
return false ;
466
461
}
467
462
468
463
bool CallBase::hasFnAttrOnCalledFunction (StringRef Kind) const {
469
- Value *V = getCalledOperand ();
470
- if (auto *CE = dyn_cast<ConstantExpr>(V))
471
- if (CE->getOpcode () == BitCast)
472
- V = CE->getOperand (0 );
473
-
474
- if (auto *F = dyn_cast<Function>(V))
464
+ if (auto *F = dyn_cast<Function>(getCalledOperand ()))
475
465
return F->getAttributes ().hasFnAttr (Kind);
476
466
477
467
return false ;
@@ -485,12 +475,7 @@ Attribute CallBase::getFnAttrOnCalledFunction(AK Kind) const {
485
475
assert (Kind != Attribute::Memory && " Use getMemoryEffects() instead" );
486
476
}
487
477
488
- Value *V = getCalledOperand ();
489
- if (auto *CE = dyn_cast<ConstantExpr>(V))
490
- if (CE->getOpcode () == BitCast)
491
- V = CE->getOperand (0 );
492
-
493
- if (auto *F = dyn_cast<Function>(V))
478
+ if (auto *F = dyn_cast<Function>(getCalledOperand ()))
494
479
return F->getAttributes ().getFnAttr (Kind);
495
480
496
481
return Attribute ();
0 commit comments