[PATCH] D47369: [DebugInfo][ScheduleDAGInstrs] Prevent scheduler from reordering DBG_VALUE instructions through their clobbering MIs

Andrew Zhogin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 29 15:10:41 PDT 2018


andrew.zhogin added a comment.

Code without this patch have DEBUG_VALUES moved before corresponding move instructions (after post-ra MI scheduler):

  	movl	%edi, %ebx
  .Ltmp1:
  	#DEBUG_VALUE: foo:returnValue <- 0.000000e+00
  	#DEBUG_VALUE: foo:s <- [DW_OP_plus_uconst 1, DW_OP_stack_value] $r14d
  	#DEBUG_VALUE: foo:c <- [DW_OP_plus_uconst 1, DW_OP_stack_value] $ebp
  	#DEBUG_VALUE: foo:i <- [DW_OP_plus_uconst 1, DW_OP_stack_value] $ebx
  	#DEBUG_VALUE: foo:s <- $r14d       >>> %r14d debug value here
  	#DEBUG_VALUE: foo:c <- $ebp         >>> %ebp debug value here
  	#DEBUG_VALUE: foo:i <- $ebx
  	movl	%esi, %ebp                             <<< %ebp def here
  .Ltmp2:
  	.loc	1 20 5 prologue_end     # ./dbg-values-reattach.cpp:20:5
  	movl	$.L.str, %edi
  	xorl	%eax, %eax
  	movl	%edx, %r14d                          <<< %r14d def here

Code with this patch have correct order for move and debug value instructions:

  	movl	%edi, %ebx
  .Ltmp1:
  	#DEBUG_VALUE: foo:i <- [DW_OP_plus_uconst 1, DW_OP_stack_value] $ebx
  	#DEBUG_VALUE: foo:i <- $ebx
  	#DEBUG_VALUE: foo:returnValue <- 0.000000e+00
  	movl	%esi, %ebp
  .Ltmp2:
  	#DEBUG_VALUE: foo:c <- [DW_OP_plus_uconst 1, DW_OP_stack_value] $ebp
  	#DEBUG_VALUE: foo:c <- $ebp
  	.loc	1 20 5 prologue_end     # ./dbg-values-reattach.cpp:20:5
  	movl	$.L.str, %edi
  	xorl	%eax, %eax
  	movl	%edx, %r14d
  .Ltmp3:
  	#DEBUG_VALUE: foo:s <- [DW_OP_plus_uconst 1, DW_OP_stack_value] $r14d
  	#DEBUG_VALUE: foo:s <- $r14d


https://reviews.llvm.org/D47369





More information about the llvm-commits mailing list