[PATCH] D109888: Bitcast wrapped in a call obscures function attributes, pessimizing MemorySSA
Antonio Frighetto via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 16 11:16:17 PDT 2021
antoniofrighetto added inline comments.
================
Comment at: llvm/lib/IR/Instructions.cpp:357-358
+
+ if (isa<Function>(V))
+ return cast<Function>(V)->getAttributes().hasFnAttr(Kind);
+
----------------
lebedev.ri wrote:
> Could also use `dyn_cast`, don't know if that would be better/worse.
Since I've changed to use `dyn_cast` before, it seems reasonable to use it here too.
================
Comment at: llvm/lib/IR/Instructions.cpp:341
/// Determine whether the argument or parameter has the given attribute.
bool CallBase::paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const {
assert(ArgNo < getNumArgOperands() && "Param index out of bounds!");
----------------
I suspect methods `CallBase::getIntrinsicID` and `CallBase::paramHasAttr` might be changed as well in the future.
================
Comment at: llvm/lib/IR/Instructions.cpp:353
if (const Function *F = getCalledFunction())
return F->getAttributes().hasFnAttr(Kind);
+
----------------
nikic wrote:
> You should be able to drop the getCalledFunction() part, as it is subsumed by the newly added code.
Right, forgot to drop it.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109888/new/
https://reviews.llvm.org/D109888
More information about the llvm-commits
mailing list