[PATCH] D150246: AMDGPU: Fix issue in shl(or) combine

Ruiling, Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 15 04:58:01 PDT 2023


ruiling added a comment.

In D150246#4341656 <https://reviews.llvm.org/D150246#4341656>, @foad wrote:

> I think this is OK, but wouldn't it be simpler to transform `((a | c1) << c2) ==> (a << c2) | (c1 << c2)` and remove the knownbits check? Or do you think that would make the generated code worse overall?

I observed more assembly instructions in one typical IR with the transform `((a | c1) << c2) ==> (a << c2) | (c1 << c2)`. That's why I wanted to remove the code in the first version. But later I find common code tries hard to make `(shl (or x, c1), c2) -> add (shl x, c2), (shl c1, c2)` happen. So I just fix the issue to help possible cases.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150246/new/

https://reviews.llvm.org/D150246



More information about the llvm-commits mailing list