Issue |
138861
|
Summary |
[WebAssembly] __table_base should not be optimized into locals (wasm locals or stack locals)
|
Labels |
new issue
|
Assignees |
|
Reporter |
mf-RDP
|
__table_base is currently defined as a non mutable global. However, think of a specific implementation that works with BOTH native and wasm (integer) function pointers - just as an example.
For global_get & global_set, their implementations could do complex modifications of the returned value (mimicked __table_base) in conjunction with call_indirect.
This works well, I did actually implement such a thing.
However, it gets broken by the following compiler optimization:
global_get(__table_base)
local_tee(42) <<<<---
i32_add(142)
call_indirect()
local_get(42)
i32_add(143)
call_indirect()
I think, as __table_base can be a highly sophisticated, implementation specific thing, it would be good not to intern it into locals.
the code above should best look like this
global_get(__table_base)
i32_add(142)
call_indirect()
global_get(__table_base) <<<<---
i32_add(143)
call_indirect()
I would say that introduced overhead is none, or absolutely minimal.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs