[PATCH] D42485: InstSimplify: If divisor element is undef simplify to undef
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 13 08:08:26 PST 2018
spatel added a comment.
In https://reviews.llvm.org/D42485#1005795, @efriedma wrote:
> udiv etc. have undefined behavior if any element of the divisor is undef. Even without optimizations, it could raise SIGFPE on x86. (See also https://reviews.llvm.org/D41944.)
>
> > Simplification based on demanded lanes could replace the last 2 constant divisor elements with 'undef'.
>
> That shouldn't happen.
Ah - thanks! This reminds me of the bug from https://reviews.llvm.org/D4424. So IIUC, it is ok for SimplifyDemandedVectorElts() to replace constants in ops that can't trap (are safe to speculate). But just like it's not ok to do that shuffle transform for div/rem, we can't replace constants in div/rem.
Repository:
rL LLVM
https://reviews.llvm.org/D42485
More information about the llvm-commits
mailing list