[all-commits] [llvm/llvm-project] 11630d: [InstCombine] Fold BW/2+1 tops bits are same pattern

David Green via All-commits all-commits at lists.llvm.org
Fri Oct 29 04:30:33 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 11630dbbc3697283c722ebfde1cd322841666b33
      https://github.com/llvm/llvm-project/commit/11630dbbc3697283c722ebfde1cd322841666b33
  Author: David Green <david.green at arm.com>
  Date:   2021-10-29 (Fri, 29 Oct 2021)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Transforms/InstCombine/icmp-topbitssame.ll
    M llvm/test/Transforms/InstCombine/truncating-saturate.ll

  Log Message:
  -----------
  [InstCombine] Fold BW/2+1 tops bits are same pattern

Match "icmp eq (trunc (lsr A, BW), (ashr (trunc A), BW-1))", which checks
the top BW/2 + 1 bits are all the same. Create "A >=s INT_MIN && A <=s
INT_MAX", which we generate as "icmp ult (add A, 2^BW-1), 2^BW" to skip
a few steps of instcombining.
https://alive2.llvm.org/ce/z/NjH6Ty
https://alive2.llvm.org/ce/z/_fEQ9P

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




More information about the All-commits mailing list