[all-commits] [llvm/llvm-project] 8299c7: [InstSimplify] Simplify icmp between Shl instructi...

Matthew Devereau via All-commits all-commits at lists.llvm.org
Mon Feb 20 01:35:46 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8299c764bd2d313334dcbabf9dd0a1f872a78612
      https://github.com/llvm/llvm-project/commit/8299c764bd2d313334dcbabf9dd0a1f872a78612
  Author: Matt Devereau <matthew.devereau at arm.com>
  Date:   2023-02-20 (Mon, 20 Feb 2023)

  Changed paths:
    M llvm/lib/Analysis/InstructionSimplify.cpp
    M llvm/test/Transforms/InstSimplify/compare.ll

  Log Message:
  -----------
  [InstSimplify] Simplify icmp between Shl instructions of the same value

define i1 @compare_vscales() {
  %vscale = call i64 @llvm.vscale.i64()
  %vscalex2 = shl nuw nsw i64 %vscale, 1
  %vscalex4 = shl nuw nsw i64 %vscale, 2
  %cmp = icmp ult i64 %vscalex2, %vscalex4
  ret i1 %cmp
}

This IR is currently emitted by LLVM. This icmp is redundant as this snippet
can be simplified to true or false as both operands originate from the same
@llvm.vscale.i64() call.

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




More information about the All-commits mailing list