[PATCH] D44997: [InstCombine] Fold compare of int constant against an integer vector splat
Daniel Neilson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 28 13:14:58 PDT 2018
dneilson created this revision.
dneilson added reviewers: spatel, anna, mkazantsev.
Herald added a subscriber: rengolin.
Folding 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 vector via a splat, and bitcast the vector
into an integer type for comparison against an integer constant. Then
if the compared-to integer constant is a splat of a pattern with the same
bitwidth as the originally splatted integer we can fold the comparison
into a compare between the splatted integer value and constant.
Repository:
rL LLVM
https://reviews.llvm.org/D44997
Files:
lib/Transforms/InstCombine/InstCombineCompares.cpp
lib/Transforms/InstCombine/InstCombineInternal.h
test/Transforms/InstCombine/icmp-bc-vecsplat.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44997.140128.patch
Type: text/x-patch
Size: 8437 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180328/3435b1a1/attachment.bin>
More information about the llvm-commits
mailing list