[PATCH] D11933: Extending debug ranges
Vikram TV via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 17 06:44:18 PDT 2015
tvvikram added a comment.
I compiled your test case with clang -O1 and here is the input to DBG_VALUE fixup pass (output of StackMapLivenessAnalysis).
# *** IR Dump After StackMap Liveness Analysis ***:
# Machine code for function f: Post SSA
Frame Objects:
fi#0: size=4, align=4, at location [SP-4]
BB#0: derived from LLVM BB %entry
PUSH64r %RAX<undef>, %RSP<imp-def>, %RSP<imp-use>; flags: FrameSetup dbg:r.c:3:7
CFI_INSTRUCTION <call frame instruction>
DBG_VALUE 23, 0, !"x", <!14>; line no:3
MOV32mi %RSP, 1, %noreg, 4, %noreg, 23; mem:ST4[%x](tbaa=!17) dbg:r.c:3:7
%RDI<def> = LEA64r %RSP, 1, %noreg, 4, %noreg
DBG_VALUE %RDI, 0, !"x", <!14>; line no:3 indirect
CALL64pcrel32 <ga:@g>, <regmask>, %RSP<imp-use>, %RDI<imp-use>, %RSP<imp-def>; dbg:r.c:4:3
%EAX<def> = MOV32rm %RSP, 1, %noreg, 4, %noreg; mem:LD4[%x](tbaa=!17) dbg:r.c:5:7
CMP32ri8 %EAX, 42, %EFLAGS<imp-def>; dbg:r.c:5:7
JNE_1 <BB#2>, %EFLAGS<imp-use>
Successors according to CFG: BB#1(16) BB#2(16)
BB#1: derived from LLVM BB %if.then
Live Ins: %EAX
Predecessors according to CFG: BB#0
DBG_VALUE 23, 0, !"x", <!14>; line no:3
%EAX<def,tied1> = INC32r %EAX<kill,tied0>, %EFLAGS<imp-def,dead>; dbg:r.c:6:5
DBG_VALUE %EAX, %noreg, !"x", <!14>; line no:3
MOV32mr %RSP, 1, %noreg, 4, %noreg, %EAX<kill>; mem:ST4[%x](tbaa=!17) dbg:r.c:6:5
Successors according to CFG: BB#2
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
# End machine code for function f.
The DBG_VALUE instr for "x" is already present in BB#2 and only "x" in RDI got propagated to BB#1.
With respect to handling variables having constant value, an early thought is to have ranges for them until the variable is moved to register. When the variable is moved to register, it will end all previous ranges of that variable because the move to register will mean that it may be operated on and the value may change. The current patch handles only register locations.
http://reviews.llvm.org/D11933
More information about the llvm-commits
mailing list