Fix a bug in ReduceLoadWidth that wasn't handling extending
authorChris Lattner <sabre@nondot.org>
Wed, 22 Dec 2010 08:02:57 +0000 (08:02 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 22 Dec 2010 08:02:57 +0000 (08:02 +0000)
commitcbf68dfbc0b36de8ef20bb42ce0c7d75cb132fc7
tree6eae5a8ce6203fee8812ca0e51d508d1e07a7823
parent7a2a7faf9cfdbdf5f1de720385dc8a0009cd60a6
Fix a bug in ReduceLoadWidth that wasn't handling extending
loads properly.  We miscompiled the testcase into:

_test:                                  ## @test
movl $128, (%rdi)
movzbl 1(%rdi), %eax
ret

Now we get a proper:

_test:                                  ## @test
movl $128, (%rdi)
movsbl (%rdi), %eax
movzbl %ah, %eax
ret

This fixes PR8757.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122392 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/X86/narrow-shl-load.ll