OSDN Git Service

[X86] Don't transform X << 1 to X + X during type legalization
authorDavid Majnemer <david.majnemer@gmail.com>
Thu, 28 Jan 2016 18:20:05 +0000 (18:20 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Thu, 28 Jan 2016 18:20:05 +0000 (18:20 +0000)
commit98232aa5c9b83687a120583d421d3bba4d690cca
tree1c166a804ae6d10df88fd6838497715b43491327
parent61400390f8eade4d2d83754ed211615d7deff908
[X86] Don't transform X << 1 to X + X during type legalization

While legalizing a 64-bit shift left by 1, the following occurs:

We split the shift operand in half: a high half and a low half.
We then create an ADDC with the low half and a ADDE with the high half +
the carry bit from the ADDC.

This is problematic if X is any_ext'd because the high half computation
is now undef + undef + carry bit and there is no way to ensure that the
two undef values had the same bitwise representation.  This results in
the lowest bit in the high half turning into garbage.

Instead, do not try to turn shifts into arithmetic during type
legalization.

This fixes PR26350.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259065 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
test/CodeGen/X86/fold-tied-op.ll
test/CodeGen/X86/pr26350.ll [new file with mode: 0644]