[patch] mergefunc struct result

When using the merge func pass with two functions that return the same kind of struct but with different element types merge func tries to do a bitcast of struct to struct.

%kv1 = type { i32*, i32* }
%kv2 = type { i8*, i8* }

define %kv1 @fn1() {

define %kv2 @fn2() {

The attached patch checks for two struct types & uses insert/extract to create the right record.

llvm-mergefunc-struct-result.diff (1.12 KB)

a) this should go to llvm-commits to increase it’s odds of being reviewed and applied
b) you’ll need to provide a full test case - both because we strong encourage one for every patch and because it’s not entirely clear what you’re getting at (at least to me)