[llvm-commits] [llvm] r148941 - in /llvm/trunk: lib/Analysis/InlineCost.cpp test/Transforms/Inline/alloca-bonus.ll
Eli Friedman
eli.friedman at gmail.com
Wed Jan 25 11:24:05 PST 2012
On Wed, Jan 25, 2012 at 10:58 AM, Nick Lewycky <nicholas at mxc.ca> wrote:
> Eli Friedman wrote:
>>
>> On Wed, Jan 25, 2012 at 12:27 AM, Nick Lewycky<nicholas at mxc.ca> wrote:
>>>
>>> Author: nicholas
>>> Date: Wed Jan 25 02:27:40 2012
>>> New Revision: 148941
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=148941&view=rev
>>> Log:
>>> Support pointer comparisons against constants, when looking at the
>>> inline-cost
>>> savings from a pointer argument becoming an alloca. Sometimes callees
>>> will even
>>> compare a pointer to null and then branch to an otherwise unreachable
>>> block!
>>> Detect these cases and compute the number of saved instructions, instead
>>> of
>>> bailing out and reporting no savings.
>>
>>
>> [Comments inlined.]
>>
>>> + } else if (ICmpInst *ICI = dyn_cast<ICmpInst>(I)) {
>>> + if (!isa<Constant>(ICI->getOperand(1)))
>>> + return 0;
>>> + ICmpInsts.push_back(ICI);
>>
>>
>> You probably want to restrict this to equality comparisons; I don't
>> think we fold relational comparisons between an alloca and a constant
>> in general.
>
>
> We do. This fits in with the rule that you aren't allowed to guess an
> alloca.
Is that rule documented somewhere?
-Eli
More information about the llvm-commits
mailing list