diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index 32af58a43b68e4..4b725610081c98 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -454,24 +454,14 @@ bool CallBase::paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const { } bool CallBase::hasFnAttrOnCalledFunction(Attribute::AttrKind Kind) const { - Value *V = getCalledOperand(); - if (auto *CE = dyn_cast(V)) - if (CE->getOpcode() == BitCast) - V = CE->getOperand(0); - - if (auto *F = dyn_cast(V)) + if (auto *F = dyn_cast(getCalledOperand())) return F->getAttributes().hasFnAttr(Kind); return false; } bool CallBase::hasFnAttrOnCalledFunction(StringRef Kind) const { - Value *V = getCalledOperand(); - if (auto *CE = dyn_cast(V)) - if (CE->getOpcode() == BitCast) - V = CE->getOperand(0); - - if (auto *F = dyn_cast(V)) + if (auto *F = dyn_cast(getCalledOperand())) return F->getAttributes().hasFnAttr(Kind); return false; @@ -485,12 +475,7 @@ Attribute CallBase::getFnAttrOnCalledFunction(AK Kind) const { assert(Kind != Attribute::Memory && "Use getMemoryEffects() instead"); } - Value *V = getCalledOperand(); - if (auto *CE = dyn_cast(V)) - if (CE->getOpcode() == BitCast) - V = CE->getOperand(0); - - if (auto *F = dyn_cast(V)) + if (auto *F = dyn_cast(getCalledOperand())) return F->getAttributes().getFnAttr(Kind); return Attribute();