[PATCH] D52257: [Thumb1] Any imm of i8 type on Thumb1 should have cost of 1

Z. Zheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 21 15:58:21 PDT 2018


zzheng added a comment.

In https://reviews.llvm.org/D52257#1241502, @SjoerdMeijer wrote:

> Ah, but looking a bit closer now, I am not sure this is the right thing to do. This changes makes any 8 bit value cheap, including negative numbers. And I am not sure if this is the right thing to do, since the Thumb1 immediates are positive numbers. It looks this a workaround for store-merging interacting badly with constant hoisting.


Depends on how it's interpreted, 0xFF is -1 in signed i8 or 255 in unsigned i8.
Right, constant hoisting breaks store merging for this case.

In https://reviews.llvm.org/D52257#1241508, @dmgreen wrote:

> Is this because we can just use a MOVS and wont have to fill in any higher bits? And MOVS's aren't trivially rematerialisable? And Thumb2/Arm are handled by getT2SOImmVal?
>
> So, yeah, looks sensible to me, and this does seem to reduce codesize. But please clean up the testcase.


Yes, since it's i8 type, no need to deal with higher bits. We ran into this case with internal workload, it's intended to reduce test case.


Repository:
  rL LLVM

https://reviews.llvm.org/D52257





More information about the llvm-commits mailing list