llvm-project/llvm
Daniel Neilson 901acfab0c [InstCombine] Fold compare of int constant against a splatted vector of ints
Summary:
Folding patterns like:
  %vec = shufflevector <4 x i8> %insvec, <4 x i8> undef, <4 x i32> zeroinitializer
  %cast = bitcast <4 x i8> %vec to i32
  %cond = icmp eq i32 %cast, 0
into:
  %ext = extractelement <4 x i8> %insvec, i32 0
  %cond = icmp eq i32 %ext, 0

Combined with existing rules, this allows us to fold patterns like:
  %insvec = insertelement <4 x i8> undef, i8 %val, i32 0
  %vec = shufflevector <4 x i8> %insvec, <4 x i8> undef, <4 x i32> zeroinitializer
  %cast = bitcast <4 x i8> %vec to i32
  %cond = icmp eq i32 %cast, 0
into:
  %cond = icmp eq i8 %val, 0

When we construct a splat vector via a shuffle, and bitcast the vector into an integer type for comparison against an integer constant. Then we can simplify the the comparison to compare the splatted value against the integer constant.

Reviewers: spatel, anna, mkazantsev

Reviewed By: spatel

Subscribers: efriedma, rengolin, llvm-commits

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

llvm-svn: 329087
2018-04-03 17:26:20 +00:00
..
bindings Fix Go IR test for changes in DIBuilder API 2018-04-02 21:45:35 +00:00
cmake Remove some unused cmake standard library includes. 2018-04-02 17:52:19 +00:00
docs [llvm-mca] Move the logic that prints register file statistics to its own view. NFCI 2018-04-03 16:46:23 +00:00
examples [ORC] Create a new SymbolStringPool by default in ExecutionSession constructor. 2018-04-02 20:57:56 +00:00
include [SLP] Fix PR36481: vectorize reassociated instructions. 2018-04-03 17:14:47 +00:00
lib [InstCombine] Fold compare of int constant against a splatted vector of ints 2018-04-03 17:26:20 +00:00
projects
resources
runtimes
test [InstCombine] Fold compare of int constant against a splatted vector of ints 2018-04-03 17:26:20 +00:00
tools [llvm-mca] Move the logic that prints register file statistics to its own view. NFCI 2018-04-03 16:46:23 +00:00
unittests [ORC] Create a new SymbolStringPool by default in ExecutionSession constructor. 2018-04-02 20:57:56 +00:00
utils Remove a stale comment cut and pasted from another file. 2018-04-03 17:07:05 +00:00
.arcconfig
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt Assume existence of inttypes.h and stdint.h in DataTypes.h. 2018-04-02 13:22:26 +00:00
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in

README.txt

Low Level Virtual Machine (LLVM)
================================

This directory and its subdirectories contain source code for LLVM,
a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.