[llvm] Count CallInst Arguments Attributes to reduce unnecessary extension (PR #73501)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 27 03:30:01 PST 2023
================
@@ -69,6 +69,20 @@ static ISD::NodeType getPreferredExtendForValue(const Instruction *I) {
NumOfSigned += CI->isSigned();
NumOfUnsigned += CI->isUnsigned();
}
+ if (const auto *CallI = dyn_cast<CallInst>(U)) {
+ for (unsigned op = 0, Eop = CallI->arg_size(); op < Eop; ++op) {
+ if (CallI->getArgOperand(op) == I) {
+ const AttributeList &PAL = CallI->getAttributes();
+ AttributeSet Attrs = PAL.getParamAttrs(op);
+ if (Attrs.hasAttributes()) {
+ for (const auto &Attr : Attrs) {
----------------
nikic wrote:
You should be calling `hasAttribute()` on the AttributeSet, not iterate over all attributes inside it and check each individually.
https://github.com/llvm/llvm-project/pull/73501
More information about the llvm-commits
mailing list