1*33224b22SAlex Crichton // clang-format off
2*33224b22SAlex Crichton // clang -o codegen-optimized.wasm -target wasm32-unknown-wasip1 -g codegen-optimized.cpp
3*33224b22SAlex Crichton // clang-format on
4*33224b22SAlex Crichton 
5*33224b22SAlex Crichton // Make sure to adjust the break locations in lldb.rs when modifying the test.
6*33224b22SAlex Crichton #define BREAKPOINT
7*33224b22SAlex Crichton 
InvalidateRegisters()8*33224b22SAlex Crichton int InvalidateRegisters() {
9*33224b22SAlex Crichton   int r1 = -1;
10*33224b22SAlex Crichton   int r2 = -2;
11*33224b22SAlex Crichton   int r3 = -3;
12*33224b22SAlex Crichton   int r4 = -4;
13*33224b22SAlex Crichton   int r5 = -5;
14*33224b22SAlex Crichton   int r6 = -6;
15*33224b22SAlex Crichton   int r7 = -7;
16*33224b22SAlex Crichton   int r8 = -8;
17*33224b22SAlex Crichton   return r1 + r2 + r3 + r4 + r5 + r6 + r7 + r8;
18*33224b22SAlex Crichton }
19*33224b22SAlex Crichton 
VariableWithSimpleLifetime()20*33224b22SAlex Crichton void VariableWithSimpleLifetime() {
21*33224b22SAlex Crichton   // Here we are testing that the value range of "x" is correctly recorded
22*33224b22SAlex Crichton   // as being bound by a loclist that is shorted than the entire method body,
23*33224b22SAlex Crichton   // even as the location can be represented with a single DWARF expression.
24*33224b22SAlex Crichton   int x = 42;
25*33224b22SAlex Crichton   InvalidateRegisters();
26*33224b22SAlex Crichton   BREAKPOINT;
27*33224b22SAlex Crichton }
28*33224b22SAlex Crichton 
InitializeTest()29*33224b22SAlex Crichton void InitializeTest() {}
30*33224b22SAlex Crichton 
main(int argc,char * argv[])31*33224b22SAlex Crichton int main(int argc, char *argv[]) {
32*33224b22SAlex Crichton   InitializeTest();
33*33224b22SAlex Crichton   VariableWithSimpleLifetime();
34*33224b22SAlex Crichton   return 0;
35*33224b22SAlex Crichton }
36