[PATCH] D122821: CallBase: fix getFnAttr so it also checks the function

James Y Knight via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 08:29:35 PDT 2022


jyknight added a subscriber: aeubanks.
jyknight added a comment.

This discrepancy in behavior seems to have arisen because getFnAttr was only added recently in 7557d6c896d3418216e82c0d0cf3b0708f2145bb <https://reviews.llvm.org/rG7557d6c896d3418216e82c0d0cf3b0708f2145bb> by @aeubanks; I suspect it was an oversight not to have it match the longstanding behavior of hasFnAttr.

Looking at the call-sites, I see that llvm/lib/Analysis/InlineCost.cpp defines its own (local) getFnAttr function with this behavior, which can now be removed in favor of the common impl.



================
Comment at: llvm/include/llvm/IR/InstrTypes.h:2308
 
+  template <typename AK> Attribute getFnAttrOnCalledFunction(AK Kind) const {
+    // Operand bundles override attributes on the called function, but don't
----------------
Probably best to put this fn next to hasFnAttrOnCalledFunction in the cc file?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122821/new/

https://reviews.llvm.org/D122821



More information about the llvm-commits mailing list