[PATCH] D103992: [InstCombine / BuildLibCalls] Add parameter attributes from the prototype.
Reid Kleckner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 17 12:46:59 PDT 2021
rnk added a comment.
I agree, we probably need to better understand what attributes we are trying to transfer. My guess is that we are trying to transfer call site attributes, things like `noinline`, `alwaysinline`, or other things inferred by optimization. If the call's prototype changes, then copying argument attributes doesn't make any sense and we should re-evaluate doing it in the first place.
================
Comment at: llvm/lib/Transforms/Utils/BuildLibCalls.cpp:1222
+ CI->setCallingConv(F->getCallingConv());
+ CI->setAttributes(F->getAttributes());
+ }
----------------
This change is fine: we are taking the attributes from a known callee.
================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:199
+static void takeAttributesFrom(CallInst *NewCI, CallInst *OrigCI) {
+ NewCI->setAttributes(OrigCI->getAttributes());
+ NewCI->removeAttributes(AttributeList::ReturnIndex,
----------------
This seems questionable. Why not take the parameter attributes from `NewCI`'s callee? What is the value of merging in the attributes from the old call?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103992/new/
https://reviews.llvm.org/D103992
More information about the llvm-commits
mailing list