[PATCH] D66978: [CodeGen] Fix lowering for returning the result of an extractvalue

Dan Gohman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 29 21:27:52 PDT 2019


sunfish added a comment.

In D66978#1652070 <https://reviews.llvm.org/D66978#1652070>, @tlively wrote:

> Generally LGTM, although the tests might be more readable if you pass `-wasm-disable-explicit-locals` and `-wasm-keep-registers` as well. It's also concerning that no one noticed this issue before. Do you know why other targets may not have run into it?


Returning aggregates in LLVM IR for most C ABIs is a complex dance, where the frontend switches to sret for structs that don't fit in registers. But here we have a Rust type, which doesn't have to follow the C ABI, which gets lowered to an aggregate return in LLVM IR without using sret. And, it turns out that wasm32 allows fewer return values than most other targets -- just one, so the Rust type doesn't fit in registers. So it gets lowered by the backend, which is where it hits this bug.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66978/new/

https://reviews.llvm.org/D66978





More information about the llvm-commits mailing list