[PATCH] D109696: [InstCombine] Add folds for certain icmp + vscale combinations

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 13 08:15:37 PDT 2021


david-arm created this revision.
david-arm added reviewers: sdesmalen, DylanFleming-arm, CarolineConcatto, spatel.
Herald added a subscriber: hiraditya.
david-arm requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Consider some simple cases like this:

  icmp ugt i64 %vscale, 1024
  icmp ugt i64 (mul i64 %vscale, 32), 1024
  icmp ugt i64 (shl i64 %vscale, 5), 1024

where

  %vscale = call i64 @llvm.vscale.i64()

We may know at compile time what the maximum value of vscale is
and therefore we may know the result of the comparison. In such cases
we can fold examples like those above away completely to return a
boolean value.

Tests added here:

  Transforms/InstCombine/icmp-vscale.ll


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109696

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/lib/Transforms/InstCombine/InstCombineInternal.h
  llvm/test/Transforms/InstCombine/icmp-vscale.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109696.372256.patch
Type: text/x-patch
Size: 7369 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210913/f4697df9/attachment.bin>


More information about the llvm-commits mailing list