brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · c67dd0a Raw
53 lines · c
1// XFAIL: !system-darwin || !target-aarch642//// Suboptimal coverage, see inlined comments.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//// Adapted from https://bugs.llvm.org/show_bug.cgi?id=34136#c410 11int g;12 13__attribute__((__noinline__))14void esc(int* p) {15  g = *p;16  *p = 5;17}18 19__attribute__((__noinline__))20void thing(int x) {21  g = x;22}23 24__attribute__((__noinline__))25int fun(int param) {26  esc(&param);      //// alloca is live until here        DexLabel('s1')27  if (param == 0) { //// end of alloca live range28    //// param is now a constant, but without lowering to dbg.value we can't29    //// capture that and would still point to the stack slot that may even have30    //// been reused by now.31    ////32    //// Right now we get suboptimal coverage for x86: the param load below is33    //// CSE'd with the if condition.34    //// Instcombine runs LowerDbgDeclare and inserts a dbg.value after the load.35    //// SelectionDAG combines the load and cmp. We go from this IR:36    ////   %0 = load i32, i32* %param.addr, align 4, !dbg !42, !tbaa !2037    ////   call void @llvm.dbg.value(metadata i32 %0, ...38    ////   %cmp = icmp eq i32 %0, 0, !dbg !4439    //// to this MIR:40    ////   DBG_VALUE $noreg, $noreg, !"param"...41    ////   CMP32mi8 %param.addr, 1, $noreg, 0, $noreg, 0, implicit-def $eflags, debug-location !4442    thing(param);43  }44  return 0; //                                            DexLabel('s2')45}46 47int main() {48  return fun(5);49}50 51// DexExpectWatchValue('param', '5',  from_line=ref('s1'), to_line=ref('s2'))52 53