[PATCH] D125556: [APInt] Allow extending and truncating to the same width

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 13 09:11:19 PDT 2022


foad created this revision.
foad added reviewers: lattner, RKSimon, lebedev.ri, spatel.
Herald added a subscriber: hiraditya.
Herald added a project: All.
foad requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125556

Files:
  llvm/include/llvm/ADT/APInt.h
  llvm/lib/Support/APInt.cpp
  llvm/unittests/ADT/APIntTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125556.429263.patch
Type: text/x-patch
Size: 5550 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220513/14031f5b/attachment.bin>


More information about the llvm-commits mailing list