[EarlyCSE] DSE of stores which write back loaded values
authorPhilip Reames <listmail@philipreames.com>
Wed, 16 Dec 2015 01:01:30 +0000 (01:01 +0000)
committerPhilip Reames <listmail@philipreames.com>
Wed, 16 Dec 2015 01:01:30 +0000 (01:01 +0000)
commit72b63ff77ddac73fc33311fd2bca250520d9111a
tree053dd8bc2a844635f225269326b228f1090fb436
parent56318195bfc629213f2b45e8769c472b0e0ea425
[EarlyCSE] DSE of stores which write back loaded values

Extend EarlyCSE with an additional style of dead store elimination. If we write back a value just read from that memory location, we can eliminate the store under the assumption that the value hasn't changed.

I'm implementing this mostly because I noticed the omission when looking at the code. It seemed strange to have InstCombine have a peephole which was more powerful than EarlyCSE. :)

Differential Revision: http://reviews.llvm.org/D15397

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255739 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/EarlyCSE.cpp
test/Transforms/EarlyCSE/basic.ll