[MergeFuncs] Fix bug in merging GetElementPointers
authorJF Bastien <jfb@google.com>
Mon, 14 Sep 2015 15:37:48 +0000 (15:37 +0000)
committerJF Bastien <jfb@google.com>
Mon, 14 Sep 2015 15:37:48 +0000 (15:37 +0000)
commit85e6f241867692c6499e321e4ac670ef83ff6c47
tree77c9034fe04cb8c18e4a841c9e1d8407e63c96cc
parente50e6f3e3d15a274f4eb065e51e6fc7a9d673843
[MergeFuncs] Fix bug in merging GetElementPointers

GetElementPointers must have the first argument's type compared
for structural equivalence. Previously the code erroneously compared the
pointer's type, but this code was dead because all pointer types (of the
same address space) are the same. The pointee must be compared instead
(using the type stored in the GEP, not from the pointer type which will
be erased anyway).

Author: jrkoenig
Reviewers: dschuff, nlewycky, jfb
Subscribers: nlewycky, llvm-commits
Differential revision: http://reviews.llvm.org/D12820

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247570 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/IPO/MergeFunctions.cpp
test/Transforms/MergeFunc/gep-base-type.ll [new file with mode: 0644]