[llvm-commits] [PATCH] Make EarlyCSE understand commutativity

Owen Anderson resistor at mac.com
Mon Oct 1 11:03:47 PDT 2012


How would you decide which commutation is the canonical one, without doing full reassociation?  I suppose you could try to find a symmetric hash function…

--Owen

On Oct 1, 2012, at 11:00 AM, Michael Ilseman <milseman at apple.com> wrote:

> Would also modifying DenseMapInfo<SimpleValue>::getHashValue(SimpleValue Val) resolve the hashing issue?
> 
> On Oct 1, 2012, at 10:56 AM, Owen Anderson <resistor at mac.com> wrote:
> 
>> 
>> On Oct 1, 2012, at 10:42 AM, Chris Lattner <clattner at apple.com> wrote:
>> 
>>> 
>>> On Sep 30, 2012, at 7:07 PM, Michael Ilseman <milseman at apple.com> wrote:
>>> 
>>>> Attached is a new version. I went with "CanonicalExpr" and added function level comments.
>>> 
>>> Hi Michael,
>>> 
>>> Why is this needed?  Why isn't it enough to change the predicate in "DenseMapInfo<SimpleValue>::isEqual" to handle commutative operations?
>> 
>> I don't think that's sufficient.  isEqual is used to resolve collisions.  It won't help here, because the commuted instructions will hash to different values up front.  Note that after reassociation we could rely on  commuted (integer) instructions being canonicalized, but that doesn't help given EarlyCSE's place in the pipeline.
>> 
>> --Owen
> 





More information about the llvm-commits mailing list