[all-commits] [llvm/llvm-project] 85b289: [SCCP] convert signed div/rem to unsigned for non-...

Sanjay Patel via All-commits all-commits at lists.llvm.org
Wed Sep 7 08:56:46 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 85b289377bff14790f402e5ea84bb24168a68fc6
      https://github.com/llvm/llvm-project/commit/85b289377bff14790f402e5ea84bb24168a68fc6
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-09-07 (Wed, 07 Sep 2022)

  Changed paths:
    M llvm/lib/Transforms/Scalar/SCCP.cpp
    M llvm/test/Transforms/PhaseOrdering/srem.ll
    M llvm/test/Transforms/SCCP/binaryops-range-special-cases.ll
    A llvm/test/Transforms/SCCP/divrem-crash.ll
    M llvm/test/Transforms/SCCP/divrem.ll

  Log Message:
  -----------
  [SCCP] convert signed div/rem to unsigned for non-negative operands, 2nd try

The original commit ( fe1f3cfc2669 ) was reverted because it could
crash / assert when trying to fold a value that was replaced
by a constant. In that case, there might not be an entry for the
constant in the solver yet.

This version adds a check for that possibility along with tests to
exercise that pattern (they used to crash).

Original commit message:
This extends the transform added with D81756 to handle div/rem opcodes.
For example:
https://alive2.llvm.org/ce/z/cX6za6

This replicates part of what CVP already does, but the motivating example
from issue #57472 demonstrates a phase ordering problem - we convert
branches to select before CVP runs and miss the transform.

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




More information about the All-commits mailing list