[all-commits] [llvm/llvm-project] 8fa432: [InstCombine] reduce test-for-overflow of shifted ...

Tian Zhou via All-commits all-commits at lists.llvm.org
Mon Sep 5 06:52:09 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8fa432be4f749c4ab0ee452d8f7c4337d67861a1
      https://github.com/llvm/llvm-project/commit/8fa432be4f749c4ab0ee452d8f7c4337d67861a1
  Author: Tian Zhou <tianzhou93 at gmail.com>
  Date:   2022-09-05 (Mon, 05 Sep 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Transforms/InstCombine/icmp-shl-1-overflow.ll

  Log Message:
  -----------
  [InstCombine] reduce test-for-overflow of shifted value

Fixes #57338.

The added code makes the following transformations:

For unsigned predicates / eq / ne:
icmp pred (x << 1), x --> icmp getSignedPredicate(pred) x, 0
icmp pred x, (x << 1) --> icmp getSignedPredicate(pred) 0, x

Some examples:
https://alive2.llvm.org/ce/z/ckn4cj
https://alive2.llvm.org/ce/z/h-4bAQ

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




More information about the All-commits mailing list