Comparing operands should not require the same ValueID
authorJF Bastien <jfb@google.com>
Wed, 26 Aug 2015 03:02:58 +0000 (03:02 +0000)
committerJF Bastien <jfb@google.com>
Wed, 26 Aug 2015 03:02:58 +0000 (03:02 +0000)
commitfd356522cd5bae1bc1b0f38971649a4ba165f463
tree6b29bc3442848b5fc5791febbefa86e011d77edb
parent091d6ba2757d2db7f5db28e3b87a0c87dd0a3360
Comparing operands should not require the same ValueID

Summary: When comparing basic blocks, there is an additional check that two Value*'s should have the same ID, which interferes with merging equivalent constants of different kinds (such as a ConstantInt and a ConstantPointerNull in the included testcase). The cmpValues function already ensures that the two values in each function are the same, so removing this check should not cause incorrect merging.

Also, the type comparison is redundant, based on reviewing the code and testing on the test suite and several large LTO bitcodes.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246001 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/IPO/MergeFunctions.cpp
test/Transforms/MergeFunc/merge-const-ptr-and-int.ll [new file with mode: 0644]
test/Transforms/MergeFunc/merge-different-vector-types.ll [new file with mode: 0644]
test/Transforms/MergeFunc/no-merge-ptr-different-sizes.ll [new file with mode: 0644]
test/Transforms/MergeFunc/no-merge-ptr-int-different-values.ll [new file with mode: 0644]
test/Transforms/MergeFunc/undef-different-types.ll [new file with mode: 0644]