[llvm-commits] [llvm] r47220 - in /llvm/trunk: lib/Transforms/IPO/GlobalOpt.cpp test/Transforms/GlobalOpt/2008-02-16-NestAttr.ll
Chris Lattner
clattner at apple.com
Sat Feb 16 14:59:28 PST 2008
On Feb 16, 2008, at 12:56 PM, Duncan Sands wrote:
> Remove any 'nest' parameter attributes if the function
> is not passed as an argument to a trampoline intrinsic.
Nice. Out of curiousity, how does nest do to codegen?
> +static const ParamAttrsList *StripNest(const ParamAttrsList *Attrs) {
> + if (Attrs) {
> + for (unsigned i = 0, e = Attrs->size(); i != e; ++i) {
> + uint16_t A = Attrs->getParamAttrsAtIndex(i);
> + if (A & ParamAttr::Nest) {
How about:
if ((A & ParamAttr::Nest) == 0) continue;
To avoid indentation in the loop. Alternatively, maybe ParamAttrsList
should have a 'find attribute' function that returns the first
argument that has the specified attribute?
> +static void RemoveNestAttribute(Function *F) {
> + F->setParamAttrs(StripNest(F->getParamAttrs()));
> + for (Value::use_iterator UI = F->use_begin(), E = F->use_end();
> UI != E;++UI){
> + Instruction *User = cast<Instruction>(*UI);
> + if (CallInst *CI = dyn_cast<CallInst>(User)) {
Please use CallSite to handle CallInst/Invoke uniformly.
Thanks Duncan!
-Chris
More information about the llvm-commits
mailing list