[PATCH] D140883: [AMDGPU] Simplify getNumFlatOffsetBits. NFC.

Ivan Kosarev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 4 02:45:15 PST 2023


kosarev added a comment.

> I agree that it is a bit simpler to conceptualize it as a signed field with a common size, especially as we already have to think about the "negative scratch offset bug" for some "signed" versions of the field. At that point, might as well just say it is always a signed field, and negative values are sometimes illegal.

The advantage of the original code is that it encapsulates (apart from the signedness and bug-handling bits, sadly) these specifics in a single place, `getNumFlatOffsetBits()`, whereas the proposed version effectively lets them leak to the surrounding logic. So on generating the error particularly the new code translates the signed non-negatives back to the precision-and-signedness representation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140883



More information about the llvm-commits mailing list