[all-commits] [llvm/llvm-project] 355ee1: [TypePromotion] Extend TypePromotion::isSafeWrap

David Green via All-commits all-commits at lists.llvm.org
Sun Nov 14 03:18:43 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 355ee18c5df9364f315f2bfad1793dd54efe6c9b
      https://github.com/llvm/llvm-project/commit/355ee18c5df9364f315f2bfad1793dd54efe6c9b
  Author: David Green <david.green at arm.com>
  Date:   2021-11-14 (Sun, 14 Nov 2021)

  Changed paths:
    M llvm/lib/CodeGen/TypePromotion.cpp
    M llvm/test/CodeGen/AArch64/and-mask-removal.ll
    M llvm/test/CodeGen/AArch64/typepromotion-overflow.ll
    M llvm/test/Transforms/TypePromotion/ARM/casts.ll
    M llvm/test/Transforms/TypePromotion/ARM/clear-structures.ll
    M llvm/test/Transforms/TypePromotion/ARM/icmps.ll
    M llvm/test/Transforms/TypePromotion/ARM/wrapping.ll

  Log Message:
  -----------
  [TypePromotion] Extend TypePromotion::isSafeWrap

This modifies the preconditions of TypePromotion's isSafeWrap
method, to allow it to work from all constants from the ICmp.
Using the code:
  %a = add %x, C1
  %c = icmp ult %a, C2

According to Alive, we can prove that is equivalent to
icmp ult (add zext(%x), sext(C1)), zext(C2)  given
C1 <=s 0 and C1 >s C2.
https://alive2.llvm.org/ce/z/CECYZB
Which is similar to what is already present. We can also
prove icmp ult (add zext(%x), sext(C1)), sext(C2) given
C1 <=s 0 and C1 <=s C2.
https://alive2.llvm.org/ce/z/KKgyeL

The PrepareWrappingAdds method was removed, and the
constants are now altered to sext or zext directly as
required by the above methods.

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




More information about the All-commits mailing list