[PATCH] D18046: [X86] Providing correct unwind info in function epilogue

Violeta Vukobrat via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 28 06:09:08 PDT 2017


violetav added a comment.

Hi Kyle, thank you for commenting!
I am not sure that I fully understand what you are proposing.
Are you saying that we should attach info about incoming and outgoing cfa_offset and register to a MBB or actually add CFI instructions to the beginning and end of a MBB (and then remove unnecessary CFI instructions later)?
Do you think that CFI instructions in epilogue should be inserted during frame lowering, when instructions that change the SP are created? Same question for the store-to-push optimization. The problem is that CFI instructions that are inserted earlier (before MBB reordering, merging, splitting, that is done in the later passes (tail duplication, control flow optimizer)) affect code generation. If we add information about incoming and outgoing CFI offset and register to a MBB, we would definitely be more flexible. That would support multiple MBBs that change CFI offset (that have different CFI offset at their beginning and end) besides prologue and epilogue. However, the problem with CFI instructions impacting code generation would still be present, and would be handled similarly to the way it is handled in the proposed implementation. Do you have something else in mind for solving this issue?
What do you think is wrong with this approach?



================
Comment at: lib/CodeGen/BranchFolding.cpp:289
+  MachineFunction &MF = *MBB1->getParent();
+  bool IsX86 = MF.getTarget().getTargetTriple().getArch() == Triple::x86_64 ||
+               MF.getTarget().getTargetTriple().getArch() == Triple::x86;
----------------
rnk wrote:
> Please don't do these types of triple checks in target independent CodeGen code. Use TII.
> 
> What are you trying to do here? Avoid tail merging epilogues, or do more tail merging, or...?
How can I use TII to get this information?

To do more tail merging (CFI instructions have different CFI indices, so isIdenticalTo() returns false, and prevents tail merging that would have happened otherwise).


Repository:
  rL LLVM

https://reviews.llvm.org/D18046





More information about the llvm-commits mailing list