[llvm-commits] [llvm] r99282 - in /llvm/trunk: lib/Transforms/Scalar/SimplifyLibCalls.cpp lib/Transforms/Utils/BuildLibCalls.cpp test/Transforms/SimplifyLibCalls/StrCpy.ll
Chris Lattner
clattner at apple.com
Wed Mar 24 09:25:45 PDT 2010
On Mar 23, 2010, at 8:10 PM, Evan Cheng wrote:
>
> On Mar 23, 2010, at 2:42 PM, Chris Lattner wrote:
>
>>
>> On Mar 23, 2010, at 8:48 AM, Evan Cheng wrote:
>>
>>> Author: evancheng
>>> Date: Tue Mar 23 10:48:04 2010
>>> New Revision: 99282
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=99282&view=rev
>>> Log:
>>> Teach simplify libcall to transform __strcpy_chk to __memcpy_chk to enable optimizations down stream.
>>
>> Hi Evan,
>>
>>> +++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Tue Mar 23 10:48:04 2010
>>> @@ -49,10 +49,13 @@
>>> Function *Caller;
>>> const TargetData *TD;
>>> LLVMContext* Context;
>>> + bool OptChkCall; // True if it's optimizing a *_chk libcall.
>>
>> This is state is not appropriate to add to LibCallOptimization. If you want to do this, it should be added as a constructor option to StrCpyOpt.
>
> Why is it inappropriate?
It's inappropriate because you're adding state to LibCallOptimization that only makes sense for StrCpyOpt, please sink it into strcpyopt.
> I can't add it to the constructor option because optimization objects are ivars. I can't construct it with "StrCpyOpt StrCpyChk(true);". And I don't want to heap allocate them.
Just initialize it in the ctor, e.g.:
SimplifyLibCalls() : FunctionPass(&ID), StrCpy(false), StrCpyChk(true) {}
-Chris
More information about the llvm-commits
mailing list