OSDN Git Service

[X86] Fix a bug in X86's peephole optimization.
authorAkira Hatanaka <ahatanaka@apple.com>
Mon, 15 Sep 2014 18:23:52 +0000 (18:23 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Mon, 15 Sep 2014 18:23:52 +0000 (18:23 +0000)
commit348e9e7b6dd3b1bee6e91009b7ea7956114ad53a
treed5dacd708832d95815046c828641c5e6619849d5
parenta1e80a1d33ab5b06a5695efba5af7f59717b3a29
[X86] Fix a bug in X86's peephole optimization.

Peephole optimization was folding MOVSDrm, which is a zero-extending double
precision floating point load, into ADDPDrr, which is a SIMD add of two packed
double precision floating point values.

(before)
%vreg21<def> = MOVSDrm <fi#0>, 1, %noreg, 0, %noreg; mem:LD8[%7](align=16)(tbaa=<badref>) VR128:%vreg21
%vreg23<def,tied1> = ADDPDrr %vreg20<tied0>, %vreg21; VR128:%vreg23,%vreg20,%vreg21

(after)
%vreg23<def,tied1> = ADDPDrm %vreg20<tied0>, <fi#0>, 1, %noreg, 0, %noreg; mem:LD8[%7](align=16)(tbaa=<badref>) VR128:%vreg23,%vreg20

X86InstrInfo::foldMemoryOperandImpl already had the logic that prevented this
from happening. However the check wasn't being conducted for loads from stack
objects. This commit factors out the logic into a new function and uses it for
checking loads from stack slots are not zero-extending loads.

rdar://problem/18236850

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217799 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86InstrInfo.cpp
test/CodeGen/X86/peephole-fold-movsd.ll [new file with mode: 0644]