[PATCH] Check for all known bits on ret in InstCombine
Philip Reames
listmail at philipreames.com
Tue Jul 22 11:24:59 PDT 2014
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.)
Philip
More information about the llvm-commits
mailing list