[all-commits] [llvm/llvm-project] 169ae6: [APInt] Allow extending and truncating to the same...

Jay Foad via All-commits all-commits at lists.llvm.org
Sat May 14 02:04:00 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 169ae6db69882605a69e184237640f0c557243ee
      https://github.com/llvm/llvm-project/commit/169ae6db69882605a69e184237640f0c557243ee
  Author: Jay Foad <jay.foad at amd.com>
  Date:   2022-05-14 (Sat, 14 May 2022)

  Changed paths:
    M llvm/include/llvm/ADT/APInt.h
    M llvm/lib/Support/APInt.cpp
    M llvm/unittests/ADT/APIntTest.cpp

  Log Message:
  -----------
  [APInt] Allow extending and truncating to the same width

Allow zext, sext, trunc, truncUSat and truncSSat to extend or truncate
to the same bit width, which is a no-op.

Disallowing this forced clients to use workarounds like using
zextOrTrunc (even though they never wanted truncation) or zextOrSelf
(even though they did not want its strange behaviour of allowing a
*smaller* bit width, which is also treated as a no-op).

Differential Revision: https://reviews.llvm.org/D125556




More information about the All-commits mailing list