Consolidate MemRefs handling from BranchFolding and correct latent bug
authorPhilip Reames <listmail@philipreames.com>
Wed, 6 Jan 2016 19:33:12 +0000 (19:33 +0000)
committerPhilip Reames <listmail@philipreames.com>
Wed, 6 Jan 2016 19:33:12 +0000 (19:33 +0000)
commit0c16176e29433f388a3ccf3246f2e56c4dac9f13
tree6405ef14aa5d99b0ac4f8136e3ee9f43b78945a2
parent1a412af4f19c45c8d947ae2912db6ac3aae59219
Consolidate MemRefs handling from BranchFolding and correct latent bug

Move the logic from BranchFolding to use the shared infrastructure for merging MMOs introduced in 256909. This has the effect of making BranchFolding more capable.

In the process, fix a latent bug. The existing handling for merging didn't handle the case where one of the instructions being merged had overflowed and dropped MemRefs. This was a latent bug in the places the code was commoned from, but potentially reachable in BranchFolding.

Once this is in, we're left with a single place to consider implementing MMO unique-ing as proposed in http://reviews.llvm.org/D15230.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256966 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/BranchFolding.cpp
lib/CodeGen/MachineInstr.cpp