[PATCH] D11918: Constant propagation after hiting assume(icmp)

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 14:20:15 PDT 2015


On Mon, Aug 10, 2015 at 2:03 PM, Nick Lewycky <nlewycky at google.com> wrote:
> On 10 August 2015 at 13:53, Daniel Berlin <dberlin at dberlin.org> wrote:
>>
>> dberlin added a comment.
>>
>> So, this is essentially trying to start to get GVN to recognize that
>> operations are made of operations on value numbers.
>>
>> Except you are only handling the really special case where those value
>> numbers are  constant over the entire program
>
>
> If you're referring to the new logic around ReplaceWithConstMap, it's
> assuming those values are constant for a single block, not the entire
> program.

Well, it's assuming the constants are valid for wherever the assume occurs :)
Which seems a valid assumption.

>
>> (instead of also handling cases where the operations simplify, or have
>> arithmetic niceties, etc. SimplifyInstruction will do some of this, but it
>> won't notice some classes of things)
>
>
> Right. The alternative is trying to update the whole BasicBlockEdge based
> system of leader numbers to handle learning new facts mid-block instead of
> along edges. :-/

Yes. Which is what i did, so i can understand why you don't want to :)


> That's just saying that if a switch has x == 7 goto block A and x == 9 goto
> block A, don't propagate x = 7 or x = 9 to block A. In this case we don't
> have two different contradictory facts, it has a single assume that has been
> executed and we can propagate that to all dominated instructions.
>
Yes, sorry, mind on other things, you are correct, since assumes can't
appear in case labels.


More information about the llvm-commits mailing list