[llvm] 5768383 - [IR] Remove check for bitcast of called function in CallBase::has/getFnAttrOnCalledFunction (#91392)
via llvm-commits
llvm-commits at lists.llvm.org
Wed May 8 10:15:32 PDT 2024
Author: Arthur Eubanks
Date: 2024-05-08T10:15:27-07:00
New Revision: 576838301d23bb779aa9c3f0cc3d086c46add44b
URL: https://github.com/llvm/llvm-project/commit/576838301d23bb779aa9c3f0cc3d086c46add44b
DIFF: https://github.com/llvm/llvm-project/commit/576838301d23bb779aa9c3f0cc3d086c46add44b.diff
LOG: [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.
Added:
Modified:
llvm/lib/IR/Instructions.cpp
Removed:
################################################################################
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();
More information about the llvm-commits
mailing list