OSDN Git Service

[DAGCombine] Don't fold a trunc if it feeds an anyext
authorMichael Kuperstein <mkuper@google.com>
Thu, 1 Sep 2016 17:59:24 +0000 (17:59 +0000)
committerMichael Kuperstein <mkuper@google.com>
Thu, 1 Sep 2016 17:59:24 +0000 (17:59 +0000)
commit1b350372389ace82417e8f2a84b039306c21008f
treee7f178d54ba608aab9ac57638278a402893f83d6
parent97a9f60dced3f7eeb0ef2610a4942ac62e92f19e
[DAGCombine] Don't fold a trunc if it feeds an anyext

Legalization tends to create anyext(trunc) patterns. This should always be
combined - into either a single trunc, a single ext, or nothing if the
types match exactly. But if we happen to combine the trunc first, we may pull
the trunc away from the anyext or make it implicit (e.g. the truncate(extract)
-> extract(bitcast) fold).

To prevent this, we can avoid doing the fold, similarly to how we already handle
fpround(fpextend).

Differential Revision: https://reviews.llvm.org/D23893

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280386 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/X86/2011-10-21-widen-cmp.ll
test/CodeGen/X86/mem-intrin-base-reg.ll