https://llvm.org/bugs/show_bug.cgi?id=24563
Bug ID: 24563 Summary: LiveDebugVariables propagates constant values without joining at bb boundaries Product: libraries Version: trunk Hardware: PC OS: All Status: NEW Severity: normal Priority: P Component: DebugInfo Assignee: unassignedb...@nondot.org Reporter: apra...@apple.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified Found while reviewing http://reviews.llvm.org/D11933 Compiling the following testcase at -O1 void g(int *); int f() { int x = 23; g(&x); if (x == 42) ++x; return x; } will cause the constant value 23 to be propagated into the last basic block: BB#2: derived from LLVM BB %if.end Predecessors according to CFG: BB#0 BB#1 DBG_VALUE 23, 0, !"x", <!14>; line no:3 %EAX<def> = MOV32rm %RSP, 1, %noreg, 4, %noreg; mem:LD4[%x](tbaa=!17) dbg:r.c:7:10 %RDX<def> = POP64r %RSP<imp-def>, %RSP<imp-use>; dbg:r.c:7:3 RETQ %EAX; dbg:r.c:7:3 Looking into this I found that LiveDebugVariables is the culprit here: void UserValue::extendDef(SlotIndex Idx, unsigned LocNo, LiveRange *LR, const VNInfo *VNI, SmallVectorImpl<SlotIndex> *Kills, LiveIntervals &LIS, MachineDominatorTree &MDT, UserValueScopes &UVS) { ... for (unsigned i = 0, e = Children.size(); i != e; ++i) { MachineBasicBlock *MBB = Children[i]->getBlock(); if (UVS.dominates(MBB)) Todo.push_back(LIS.getMBBStartIdx(MBB)); } } It look like it just unconditionally propagates all DBG_VALUEs down the dominator tree, which happens to work fine if there already is another DBG_VALUE but is wrong if the DBG_VALUE is coming from only one of the predecessors like in this example here. The DBG_VALUES should only end up in a subsequent basic block if they appear at the end of all predecessors. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs