[PATCH] D142542: [InstSimplify] Simplify icmp between Left-Shifted VScale Calls

Matt Devereau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 06:55:06 PST 2023


MattDevereau created this revision.
MattDevereau added reviewers: sdesmalen, dtemirbulatov, peterwaller-arm, spatel.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
MattDevereau requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

[InstSimplify] Simplify icmp between Left-Shifted VScale Calls

      

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142542

Files:
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/test/Transforms/InstSimplify/compare.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142542.492094.patch
Type: text/x-patch
Size: 4895 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230125/dee348eb/attachment.bin>


More information about the llvm-commits mailing list