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)