[PATCH] D42485: InstSimplify: If divisor element is undef simplify to undef
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 12 16:13:07 PST 2018
spatel added a subscriber: RKSimon.
spatel added a comment.
After discussing this with @RKSimon , I think this patch was wrong. Undef in a lane is not the same as undefined behavior in a lane.
So we're not allowed to assume the undef value is '0' here. This will cause trouble when paired with InstCombiner::SimplifyDemandedVectorElts().
Example:
define i8 @sdiv_undef_elt_vec(<4 x i8> %x) {
%div = sdiv <4 x i8> %x, <i8 1, i8 2, i8 3, i8 4>
%ext0 = extractelement <4 x i8> %div, i32 0
%ext1 = extractelement <4 x i8> %div, i32 1
%add = add i8 %ext0, %ext1
ret i8 %add
}
Simplification based on demanded lanes could replace the last 2 constant divisor elements with 'undef'. This patch will then have the whole function produce undef. That can't be right.
Repository:
rL LLVM
https://reviews.llvm.org/D42485
More information about the llvm-commits
mailing list