1 | // XFAIL: * |
2 | // Incorrect location for variable "parama", see PR48719. |
3 | |
4 | // REQUIRES: lldb |
5 | // UNSUPPORTED: system-windows |
6 | // RUN: %clang -std=gnu11 -O3 -glldb %s -o %t |
7 | // RUN: %dexter --fail-lt 1.0 -w --debugger lldb --binary %t -- %s |
8 | |
9 | // 1. parama is escaped by esc(¶ma) so it is not promoted by |
10 | // SROA/mem2reg. |
11 | // 2. InstCombine's LowerDbgDeclare converts the dbg.declare to a set of |
12 | // dbg.values (tracking the stored SSA values). |
13 | // 3. InstCombine replaces the two stores to parama's alloca (the initial |
14 | // parameter register store in entry and the assignment in if.then) with a |
15 | // PHI+store in the common sucessor. |
16 | // 4. SimplifyCFG folds the blocks together and converts the PHI to a |
17 | // select. |
18 | |
19 | // The debug info is not updated to account for the merged value in the |
20 | // sucessor prior to SimplifyCFG when it exists as a PHI, or during when it |
21 | // becomes a select. As a result we see parama=5 for the entire function, when |
22 | // we'd expect to see param=20 when stepping onto fluff(). |
23 | |
24 | __attribute__((optnone)) |
25 | void esc(int* p) {} |
26 | |
27 | __attribute__((optnone)) |
28 | void fluff() {} |
29 | |
30 | __attribute__((noinline)) |
31 | int fun(int parama, int paramb) { |
32 | if (parama) |
33 | parama = paramb; |
34 | fluff(); // DexLabel('s0') |
35 | esc(p: ¶ma); |
36 | return 0; |
37 | } |
38 | |
39 | int main() { |
40 | return fun(parama: 5, paramb: 20); |
41 | } |
42 | |
43 | // DexExpectWatchValue('parama', 20, on_line=ref('s0')) |
44 | |