OSDN Git Service

X86CallFrameOptimization: Recognize 'store 0/-1 using and/or' idioms
authorZvi Rackover <zvi.rackover@intel.com>
Tue, 24 Oct 2017 12:13:05 +0000 (12:13 +0000)
committerZvi Rackover <zvi.rackover@intel.com>
Tue, 24 Oct 2017 12:13:05 +0000 (12:13 +0000)
commit1d169cfff5b7c5bc7edfaa741f47da379b4abb7e
treeddb6bcd9d9f4c83be497bca4e132c52f1809d664
parente1bccd3b6ef768da549d43d434a0c1d962369f3e
X86CallFrameOptimization: Recognize 'store 0/-1 using and/or' idioms

Summary:
r264440 added or/and patterns for storing -1 or 0 with the intention of decreasing code size. However,
X86CallFrameOptimization does not recognize these memory accesses so it will not replace them with push's when profitable.

This patch fixes this problem by teaching X86CallFrameOptimization these store 0/-1 idioms.

An alternative fix would be to prevent the 'store 0/1 idioms' patterns from firing when accessing the stack. This would save
the need to teach the pass about these idioms. However, because X86CallFrameOptimization does not always fire we may result
in cases where neither X86CallFrameOptimization not the patterns for 'store 0/1 idioms' fire.

Fixes pr34863

Reviewers: DavidKreitzer, guyblank, aymanmus

Reviewed By: aymanmus

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316431 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86CallFrameOptimization.cpp
test/CodeGen/X86/memcmp-minsize.ll
test/CodeGen/X86/movtopush.ll
test/CodeGen/X86/movtopush64.ll