[PATCH] D42848: Correct dwarf unwind information in function epilogue

Violeta Vukobrat via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 20 08:15:02 PDT 2018


violetav added inline comments.


================
Comment at: test/CodeGen/X86/GlobalISel/add-scalar.ll:23
 ; X32-NEXT:    popl %ebp
+; X32-NEXT:    .cfi_def_cfa %esp, 4
 ; X32-NEXT:    retl
----------------
thegameg wrote:
> I think this change made sense before. What happened?
The test was changed in the meantime: https://reviews.llvm.org/D45146#change-3jDxqMq6Nhg4.


================
Comment at: test/CodeGen/X86/avx512-regcall-Mask.ll:197
 ; LINUXOSX64-NEXT:    addq $24, %rsp
-; LINUXOSX64-NEXT:    .cfi_adjust_cfa_offset -16
+; LINUXOSX64-NEXT:    .cfi_adjust_cfa_offset -24
 ; LINUXOSX64-NEXT:    popq %r12
----------------
thegameg wrote:
> Hmm, I still don't really understand this change.
I'll try to explain.
Without CFI instructions in epilogue, merging would occur, but adjust_cfa_offset used to have wrong offset value set.

Then, when CFI in epilogue were added, they prevented merging, and the situation was the following:
  ...
	callq	test_argv64i1
	addq	$16, %rsp
	.cfi_adjust_cfa_offset -16
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
  ...

Now, CFI instruction, in this case the '.cfi_def_cfa_offset 40', doesn't prevent merging, and correct offset (24) is set to cfi_adjust_cfa directive.
Merging and creating corresponding adjust_cfa_offset happens after emitEpilogue(), when cfi in epilogue are already inserted. Hope this helps clear things up a bit.


Repository:
  rL LLVM

https://reviews.llvm.org/D42848





More information about the llvm-commits mailing list