[CodeGen] Fix lowering for returning the result of an extractvalue
authorDan Gohman <dan433584@gmail.com>
Fri, 30 Aug 2019 04:33:22 +0000 (04:33 +0000)
committerDan Gohman <dan433584@gmail.com>
Fri, 30 Aug 2019 04:33:22 +0000 (04:33 +0000)
commit8cfeeaf9de0b24248be1074c7593107c748cc16c
tree404588e3b8a1b9f8525ebfb406ea6c94e51ad238
parentbd0f840f83e56d36ace49b04b499f107be7eb492
[CodeGen] Fix lowering for returning the result of an extractvalue

When the number of return values exceeds the number of registers available,
SelectionDAGBuilder::visitRet transforms a function's return to use a
pointer to a buffer to hold return values. When the returned value is an
operator such as extractvalue, the value may have a non-zero result number.
Add that number to the indexing when obtaining the values to store.

This fixes https://bugs.llvm.org/show_bug.cgi?id=43132.

Differential Revision: https://reviews.llvm.org/D66978

llvm-svn: 370430
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/test/CodeGen/WebAssembly/multi-return.ll [new file with mode: 0644]