summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Eubanks <aeubanks@google.com>2024-05-08 10:15:27 -0700
committerGitHub <noreply@github.com>2024-05-08 10:15:27 -0700
commit576838301d23bb779aa9c3f0cc3d086c46add44b (patch)
tree586031f251a31c10cdc511e003e8cac258db0011
parenta620697340671aea2b0c65449fcddf3c2e4d1917 (diff)
[IR] Remove check for bitcast of called function in CallBase::has/getFnAttrOnCalledFunction (#91392)
With opaque pointers, we shouldn't have bitcasts between function pointer types.
-rw-r--r--llvm/lib/IR/Instructions.cpp21
1 files changed, 3 insertions, 18 deletions
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index 32af58a43b68..4b725610081c 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<ConstantExpr>(V))
- if (CE->getOpcode() == BitCast)
- V = CE->getOperand(0);
-
- if (auto *F = dyn_cast<Function>(V))
+ if (auto *F = dyn_cast<Function>(getCalledOperand()))
return F->getAttributes().hasFnAttr(Kind);
return false;
}
bool CallBase::hasFnAttrOnCalledFunction(StringRef Kind) const {
- Value *V = getCalledOperand();
- if (auto *CE = dyn_cast<ConstantExpr>(V))
- if (CE->getOpcode() == BitCast)
- V = CE->getOperand(0);
-
- if (auto *F = dyn_cast<Function>(V))
+ if (auto *F = dyn_cast<Function>(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<ConstantExpr>(V))
- if (CE->getOpcode() == BitCast)
- V = CE->getOperand(0);
-
- if (auto *F = dyn_cast<Function>(V))
+ if (auto *F = dyn_cast<Function>(getCalledOperand()))
return F->getAttributes().getFnAttr(Kind);
return Attribute();