[all-commits] [llvm/llvm-project] eb0e7a: [InstCombine] canEvaluateTruncated - use KnownBits...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Fri Jul 3 08:02:38 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: eb0e7acbd4853c31a1401c8f02586850fee15107
      https://github.com/llvm/llvm-project/commit/eb0e7acbd4853c31a1401c8f02586850fee15107
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2020-07-03 (Fri, 03 Jul 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
    M llvm/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll
    M llvm/test/Transforms/InstCombine/cast.ll
    M llvm/test/Transforms/InstCombine/trunc.ll

  Log Message:
  -----------
  [InstCombine] canEvaluateTruncated - use KnownBits to check for inrange shift amounts

Currently canEvaluateTruncated can only attempt to truncate shifts if they are scalar/uniform constant amounts that are in range.

This patch replaces the constant extraction code with KnownBits handling, using the KnownBits::getMaxValue to check that the amounts are inrange.

This enables support for nonuniform constant cases, and also variable shift amounts that have been masked somehow. Annoyingly, this still won't work for vectors with (demanded) undefs as KnownBits returns nothing in those cases, but its a definite improvement on what we currently have.

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




More information about the All-commits mailing list