On Feb 17, 2008, at 8:06 PM, Owen Anderson wrote: > Author: resistor > Date: Sun Feb 17 22:06:26 2008 > New Revision: 47254 > > URL: http://llvm.org/viewvc/llvm-project?rev=47254&view=rev > Log: > Duncan pointed out that we can fast fail here, because the sret > parameter of > a function must be the first parameter.
getArgNo() is linear time, please compare against F->abegin(). -Chris > > > Modified: > llvm/trunk/lib/VMCore/Function.cpp > > Modified: llvm/trunk/lib/VMCore/Function.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=47254&r1=47253&r2=47254&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/VMCore/Function.cpp (original) > +++ llvm/trunk/lib/VMCore/Function.cpp Sun Feb 17 22:06:26 2008 > @@ -107,7 +107,8 @@ > /// it in its containing function. > bool Argument::hasStructRetAttr() const { > if (!isa<PointerType>(getType())) return false; > - return getParent()->paramHasAttr(getArgNo()+1, > ParamAttr::StructRet); > + if (getArgNo()) return false; // StructRet param must be first > param > + return getParent()->paramHasAttr(1, ParamAttr::StructRet); > } > > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits