brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 492e42d Raw
44 lines · c
1// XFAIL: *2// Incorrect location for variable "parama", see PR48719.3 4// REQUIRES: lldb5// UNSUPPORTED: system-windows6// RUN: %clang -std=gnu11 -O3 -glldb %s -o %t7// RUN: %dexter --fail-lt 1.0 -w %dexter_lldb_args --binary %t -- %s8 9// 1. parama is escaped by esc(&parama) so it is not promoted by10//    SROA/mem2reg.11// 2. InstCombine's LowerDbgDeclare converts the dbg.declare to a set of12//    dbg.values (tracking the stored SSA values).13// 3. InstCombine replaces the two stores to parama's alloca (the initial14//    parameter register store in entry and the assignment in if.then) with a15//    PHI+store in the common sucessor.16// 4. SimplifyCFG folds the blocks together and converts the PHI to a17//    select.18 19// The debug info is not updated to account for the merged value in the20// sucessor prior to SimplifyCFG when it exists as a PHI, or during when it21// becomes a select. As a result we see parama=5 for the entire function, when22// we'd expect to see param=20 when stepping onto fluff().23 24__attribute__((optnone))25void esc(int* p) {}26 27__attribute__((optnone))28void fluff() {}29 30__attribute__((noinline))31int fun(int parama, int paramb) {32  if (parama)33    parama = paramb;34  fluff();           // DexLabel('s0')35  esc(&parama);36  return 0;37}38 39int main() {40  return fun(5, 20);41}42 43// DexExpectWatchValue('parama', 20, on_line=ref('s0'))44