Issue |
146528
|
Summary |
Weird behavior of padding of `-target-abi experimental-mv`
|
Labels |
new issue
|
Assignees |
|
Reporter |
yhx-12243
|
When compiling WebAssembly using `-target-abi experimental-mv`, the struct with padding will result in a very weird padding result: Use a lot of `i32` to waste with. For example:
`1.cpp`:
```cpp
struct Unit {};
struct A {
int x;
Unit c;
};
A foo() {
return {};
}
```
Compiling command: `clang++ 1.cpp -S -O3 --target=wasm32-unknown-unknown -Xclang -target-abi -Xclang experimental-mv`
Result `1.s`:
```wat
.file "1.cpp"
.functype _Z3foov () -> (i32, i32, i32, i32, i32)
.section .text._Z3foov,"",@
.hidden _Z3foov # -- Begin function _Z3foov
.globl _Z3foov
.type _Z3foov,@function
_Z3foov: # @_Z3foov
.functype _Z3foov () -> (i32, i32, i32, i32, i32)
.local i32
# %bb.0:
i32.const 0
local.get 0
local.get 0
local.get 0
local.get 0
# fallthrough-return
end_function
# -- End function
```
However, if I change `Unit` into `char`, the behavior is as we expected.
I think it is a bug of experimental-mv ABI.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs