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