[all-commits] [llvm/llvm-project] 258a0a: [ConstraintElimination] Use simplified constraint ...

Florian Hahn via All-commits all-commits at lists.llvm.org
Thu Jan 27 05:31:49 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 258a0a3a551745e7250d7831e6b477e49708a08c
      https://github.com/llvm/llvm-project/commit/258a0a3a551745e7250d7831e6b477e49708a08c
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2022-01-27 (Thu, 27 Jan 2022)

  Changed paths:
    M llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
    M llvm/test/Transforms/ConstraintElimination/ne.ll

  Log Message:
  -----------
  [ConstraintElimination] Use simplified constraint for == 0.

When checking x == 0, checking x u<= 0 is sufficient and simpler than
x u>= 0 && x u<= 0.

https://alive2.llvm.org/ce/z/btM7d3

    ----------------------------------------
    define i1 @src(i4 %a) {
    %0:
      %c = icmp eq i4 %a, 0
      ret i1 %c
    }
    =>
    define i1 @tgt(i4 %a) {
    %0:
       %c = icmp ule i4 %a, 0
       ret i1 %c
    }
    Transformation seems to be correct!




More information about the All-commits mailing list