brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 2cf3e96 Raw
47 lines · c
1// Location for variable "parama" optimized out.2// Previously it would carry incorrect location3// information in debug-info, see PR48719.4// Now, the location is simply not emitted.5 6// REQUIRES: lldb7// UNSUPPORTED: system-windows8// RUN: %clang -std=gnu11 -O3 -glldb %s -o %t9// RUN: %dexter --fail-lt 0.1 -w %dexter_lldb_args --binary %t -- %s10// See NOTE at end for more info about the RUN command.11 12// 1. SROA/mem2reg fully promotes parama.13// 2. parama's value in the final block is the merge of values for it coming14//    out of entry and if.then. If the variable were used later in the function15//    mem2reg would insert a PHI here and add a dbg.value to track the merged16//    value in debug info. Because it is not used there is no PHI (the merged17//    value is implicit) and subsequently no dbg.value.18// 3. SimplifyCFG later folds the blocks together (if.then does nothing besides19//    provide debug info so it is removed and if.end is folded into the entry20//    block).21 22// The debug info is not updated to account for the implicit merged value prior23// to (e.g. during mem2reg) or during SimplifyCFG so we end up seeing parama=524// for the entire function, which is incorrect.25 26__attribute__((optnone))27void fluff() {}28 29__attribute__((noinline))30int fun(int parama, int paramb) {31  if (parama)32    parama = paramb;33  fluff();            // DexLabel('s0')34  return paramb;35}36 37int main() {38  return fun(5, 20);39}40 41// DexExpectWatchValue('parama', 20, on_line=ref('s0'))42//43// NOTE: the dexter command uses --fail-lt 0.1 (instead of the standard 1.0)44// because seeing 'optimized out' would still be a win; it's the best we can do45// without using conditional DWARF operators in the location expression. Seeing46// 'optimized out' should result in a score higher than 0.1.47