[PATCH] D109683: [APInt] Add APIntOps::ScaleBitMask helper

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 13 04:48:13 PDT 2021


RKSimon created this revision.
RKSimon added reviewers: craig.topper, lebedev.ri, lattner.
Herald added subscribers: dexonsmith, hiraditya.
RKSimon requested review of this revision.
Herald added a project: LLVM.

APInt is used to describe a bit mask in a variety of value tracking and demanded bits/elts functions.

When traversing through dst/src operands, we have a number of places where these masks need to widened/narrowed to translate through bitcasts, reductions etc. to a different type.

This patch add a APIntOps::ScaleBitMask common helper, adds unit test coverage, and updates a number of cases to use the the helper instead of their own implementation.

This came up on D109065 <https://reviews.llvm.org/D109065> where we currently have to add yet another implementation of the same code.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109683

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109683.372216.patch
Type: text/x-patch
Size: 6607 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210913/185d05e1/attachment.bin>


More information about the llvm-commits mailing list