[PATCH][CodeGen] Fix a bug in bitcast optimization of DAGCombiner

Jiangning Liu liujiangning1 at gmail.com
Tue Mar 31 02:47:07 PDT 2015


Hi,

The small patch attached is to fix a bug in bitcast optimization of
DAGCombiner.

Originally, the code tries to optimize bitcast with build_vector input to
be a scalar_to_vector, if only the bitcast and build_vector can meet some
conditions. In particular, it thought "ThisVal.zext(SrcBitSize) == OpVal"
is one of the requirements. This requirement means, if zero extension of a
narrow element value is equal to the original wide element value, the
optimization would be allowed. Unfortunately this is incorrect, because the
semantic of scalar_to_vector is the top 1 to N-1 elements are undef rather
than zero. So no matter we use zero_extension or sign_extension, this
transformation would be always invalid. The patch attached disables this
optimization.

Thanks,
-Jiangning
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150331/d502417e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_bitcast_opt.patch
Type: text/x-patch
Size: 1989 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150331/d502417e/attachment.bin>


More information about the llvm-commits mailing list