1 // XFAIL:*
2 //// See PR47946.
3 
4 // REQUIRES: lldb
5 // UNSUPPORTED: system-windows
6 // RUN: %dexter --fail-lt 1.0 -w --debugger lldb \
7 // RUN:     --builder clang-c  --cflags "-O2 -glldb" -- %s
8 //
9 //// Check that once-escaped variable 'param' can still be read after we
10 //// perform inlining + mem2reg, and that we see the DSE'd value 255.
11 
12 
13 int g;
14 __attribute__((__always_inline__))
use(int * p)15 static void use(int* p) {
16   g = *p;
17   *p = 255;
18   volatile int step = 0;  // DexLabel('use1')
19 }
20 
21 __attribute__((__noinline__))
fun(int param)22 void fun(int param) {
23   //// Make sure first step is in 'fun'.
24   volatile int step = 0;  // DexLabel('fun1')
25   use(&param);
26   return;                 // DexLabel('fun2')
27 }
28 
main()29 int main() {
30   fun(5);
31 }
32 
33 /*
34 # Expect param == 5 before stepping through inlined 'use'.
35 DexExpectWatchValue('param', '5', on_line='fun1')
36 
37 # Expect param == 255 after assignment in inlined frame 'use'.
38 DexExpectProgramState({
39   'frames': [
40     { 'function': 'use',
41       'location': { 'lineno': 'use1' },
42     },
43     { 'function': 'fun',
44       'location': { 'lineno': 20 },
45       'watches':  { 'param': '255' }
46     },
47   ]
48 })
49 
50 # Expect param == 255 after inlined call to 'use'.
51 DexExpectWatchValue('param', '255', on_line='fun2')
52 */
53