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

Chandler Carruth chandlerc at google.com
Mon Oct 8 23:32:36 PDT 2012


On Mon, Oct 8, 2012 at 11:27 PM, Michael Ilseman <milseman at apple.com> wrote:

> If this impacts commutativity, both the hashing and equality testing
> should respect it.
>
>
> Overflow should be orthogonal to commutativity. I think you're right in
> that hashing should respect it, so I'll mix in the overflow bits for the
> hash.
>

Oh, of course. I misread that bit. Yea, just mix it in. =]


> If you can't lift this logic into the operator (or instruction), maybe
> factor all of the commutatitivy logic? Make a static isCommutativeOp()
> static function, and then you can even fold the CmpInst logic into it as
> well?
>
>
> I'm not sure what's meant here. What code will be simplified by this?
> CmpInsts are a little different in that even "non-commutative" compares can
> be commuted if the predicate is swapped. In my patches, I canonicalize
> based on address (and swap the predicate accordingly).
>

Yea, guess it wouldn't really help much there. LGTM.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121008/9fc16184/attachment.html>


More information about the llvm-commits mailing list