G_PTR_ADD takes arguments of two different types, so it probably shouldn't be
considered commutative just on that basis. A recent G_PTR_ADD reassociation
optimization (https://reviews.llvm.org/D109528) can emit erroneous code if the
pattern matcher commutes the arguments; this can happen when the base pointer
was created by G_INTTOPTR of a G_CONSTANT and the offset register is variable.
This was discovered on the llvm-mos fork, but I added a failing test case that
should apply to AArch64 (and more generally).
Also, this is my first change to LLVM proper, so please let me know if there's
anything amiss with my interpretation of the CR process. Take care!