OSDN Git Service

[DAGCombine] Catch the case where extract_vector_elt can cause an any_ext while proce...
authorSilviu Baranga <silviu.baranga@arm.com>
Mon, 21 Mar 2016 11:43:46 +0000 (11:43 +0000)
committerPirama Arumuga Nainar <pirama@google.com>
Thu, 24 Mar 2016 18:35:18 +0000 (11:35 -0700)
commit54319a9ff51f01a78b8b975a2eef0b8d52f9efe6
tree026749a9c9ff699e1939f89b19840d5617e1b69a
parentcddc3e03e4ec99c0268c03a126195173e519ed58
[DAGCombine] Catch the case where extract_vector_elt can cause an any_ext while processing AND SDNodes

Summary:
extract_vector_elt can cause an implicit any_ext if the types don't
match. When processing the following pattern:

  (and (extract_vector_elt (load ([non_ext|any_ext|zero_ext] V))), c)

DAGCombine was ignoring the possible extend, and sometimes removing
the AND even though it was required to maintain some of the bits
in the result to 0, resulting in a miscompile.

This change fixes the issue by limiting the transformation only to
cases where the extract_vector_elt doesn't perform the implicit
extend.

Reviewers: t.p.northover, jmolloy

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D18247

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263935 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/ARM/dagcombine-anyexttozeroext.ll