[all-commits] [llvm/llvm-project] 8d3894: [TypePromotion] Fix another case for sext vs zext ...

Craig Topper via All-commits all-commits at lists.llvm.org
Fri May 20 09:30:53 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8d3894f67ebf475e4393abeab91736bf534ff8f8
      https://github.com/llvm/llvm-project/commit/8d3894f67ebf475e4393abeab91736bf534ff8f8
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2022-05-20 (Fri, 20 May 2022)

  Changed paths:
    M llvm/lib/CodeGen/TypePromotion.cpp
    M llvm/test/Transforms/TypePromotion/ARM/icmps.ll

  Log Message:
  -----------
  [TypePromotion] Fix another case for sext vs zext in promoted constant.

If the SafeWrap operation is a subtract, we negated the constant
to treat the subtract as an addition. The sext was based on the
operation being addition. So we really need to do (neg (sext (neg C)))
when promoting the constant. This is equivalent to (sext C) for
every value of C except the min signed value. For min signed value
we need to do (zext C) instead.

Fixes PR55490.

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




More information about the All-commits mailing list