[PATCH] Check for all known bits on ret in InstCombine

Chandler Carruth chandlerc at google.com
Tue Jul 22 11:40:05 PDT 2014


On Tue, Jul 22, 2014 at 11:24 AM, Philip Reames <listmail at philipreames.com>
wrote:

> On 07/22/2014 10:25 AM, Hal Finkel wrote:
>
>>
>>  2) When do we remove a llvm.assume? In your test case, you had an
>>> assume which (after the transform) retained a condition about an
>>> otherwise used value (%a). This seems like an obvious case to remove
>>> since we've gotten all the benefit we can from it. Are there other
>>> cases like this we should implement?
>>>
>> No, I disagree.
>>
> This is exactly the discussion we need to be having then.  :)
>
>  We don't want to remove the invariants until after inlining is complete.
>> And for alignment guarantees, for example, we don't want to remove them
>> until after vectorization and unrolling. Currently, they're removed on
>> entry to CodeGen, and it is not clear to me that we need or want to do
>> anything else.
>>
> I don't agree with this.  I see several cases where removing them early
> seems like a good idea.  Consider:
> - Once we recognize an assumption and canonicalize it as an attribute, we
> should immediately remove the assumption.  The assumption conveys no
> additional information and only limits optimization.  All of the semantic
> information is available in the attribute.  If your concern is that we
> loose this information on inlining, then maybe we need to address *that*.
> - Once the values which contribute to the assumption become otherwise
> dead, what does information about those values tell us? It seems like
> there's no profit to be had by keeping it.  (Thinking about it, my original
> question/proposal was wrong.  "%a" was a parameter.  There might be later
> uses of the value after inlining. For discussion, let's pretend "%a" had
> been the result of a pure function call or something.)


I think these are the exceptions rather than the rules?

Essentially, I think that "promoting" an assumption to an attribute clearly
supplants the need for the assumption intrinsic. And I think that we should
clearly DCE *completely dead* sub-graphs that are being kept alive solely
due to the assumption.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140722/835d59aa/attachment.html>


More information about the llvm-commits mailing list