summaryrefslogtreecommitdiff
path: root/test/gtest/stringify.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-08-02 12:18:31 -0700
committerGitHub <noreply@github.com>2023-08-02 12:18:31 -0700
commitb9f4e3609312473315cc401a2d8501e7a7731b04 (patch)
tree14dc5c8da3fc96aa2c1833d34033ecf8b4e51c79 /test/gtest/stringify.cpp
parent1db7a94a50a4317d705568218cf0221f8cff5994 (diff)
downloadbinaryen-b9f4e3609312473315cc401a2d8501e7a7731b04.tar.gz
binaryen-b9f4e3609312473315cc401a2d8501e7a7731b04.tar.bz2
binaryen-b9f4e3609312473315cc401a2d8501e7a7731b04.zip
GUFA: Infer using TrapsNeverHappen (#5850)
This adds a TrapsNeverHappen oracle that is used inside the main PossibleContents oracle of GUFA. The idea is that when traps never happen we can reason "backwards" from information to things that must be true before it: temp = x.field; x.cast_to<Y>(); // Y is a subtype of x's type X Here we cast x to a subtype. If we assume traps never happen then the cast must succeed, and that means we can assume we had a Y on the previous line, where perhaps that information lets us infer the value of x.field. This PR focuses on calls, which are the more interesting situation to optimize because other passes do some work already inside functions. Specifically, we look for things that will trap in the called function or the caller, such as if the called function always casts a param to some type, we can assume the caller passes such a type in. And if we have a call_ref then any target that would trap cannot be called (at least in a closed world). This has some benefits, in particular when combined with --gufa-cast-all since that casts more things, which lets us apply the inferences made here. I see 3.3% fewer call_ref instructions on a Kotlin testcase, for example. This helps more on -Os when we inline less.
Diffstat (limited to 'test/gtest/stringify.cpp')
0 files changed, 0 insertions, 0 deletions