Changqing-JING wrote:

Thank you for reply.
Yes, the #201966 works for me.

_What you're using Wasm globals for?_
I'm using immutable import global to do some platform specific branch 
optimization in Wasm AOT compiler.
For example, in pseudo code
```
import function getOS;
if(getOS() == someOS){
   doSomething();
}
```
Fristly, both llvm and binaryen can't optimize this code since OS is unknown at 
compile time.
For Wasm AOT compiler, the `getOS() == someOS` logically can know at compile 
time, but AOT compiler itself also don't know what's the return of a custom 
import function.
So I want to use
```
import immutable global currentOS;
if(currentOS == someOS){
   doSomething();
}
```

Then AOT compiler can easily optimize the if branch.

https://github.com/llvm/llvm-project/pull/200722
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to