[all-commits] [llvm/llvm-project] 9db208: [APInt] Add APIntOps::ScaleBitMask helper

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Mon Sep 13 08:27:59 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9db20822f795f1057d5ba31bdc2aa82a6d96a6a0
      https://github.com/llvm/llvm-project/commit/9db20822f795f1057d5ba31bdc2aa82a6d96a6a0
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2021-09-13 (Mon, 13 Sep 2021)

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

  Log Message:
  -----------
  [APInt] Add APIntOps::ScaleBitMask helper

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 where we currently have to add yet another implementation of the same code.

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




More information about the All-commits mailing list