[PATCH] D35375: [AArch64][Atomic] Canonicalize sub of immediate to add of -immediate.

Geoff Berry via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 14 13:33:07 PDT 2017


gberry added a comment.

I suppose the analogous InstCombine canonicalization in this case is to convert all 'sub's of immediates to 'add's of negated immediates doesn't really apply, since there isn't much additional optimization that can be done on the atomic operations themselves.

Is there any reason to restrict this to cases where the sub operand is a constant?  Since we're always going to add a sub 0, x in ISel, adding it a bit earlier in the DAG combine phase would allow for additional optimizations in the non-constant case as well (e.g. folding a double negate away).


https://reviews.llvm.org/D35375





More information about the llvm-commits mailing list