[PATCH] D46671: Use iteration instead of recursion in CFIInserter

Violeta Vukobrat via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 10 08:03:51 PDT 2018


violetav added a comment.

Incoming offset/register values of each successor block should match outgoing offset/register values of its predecessors.

This change potentially won't set correct offset/register to indirect successors - you always set incoming values to all successors to be the outgoing values of the current block, which can turn out to be the same as outgoing values of their direct predecessor, but not necessarily. Consider this example:

  # RUN: llc -o - %s -mtriple=x86_64-- -verify-cfiinstrs -run-pass=cfi-instr-inserter
  
  --- |
    define void @foo() { ret void }
  ...
  ---
  name: foo
  body: |
    bb.0:
      JE_1 %bb.3, implicit $eflags
    bb.1:
      CFI_INSTRUCTION def_cfa_offset 24
    bb.2:
      CFI_INSTRUCTION def_cfa_offset 8
    bb.3:
      RET 0
  ...

bb2 will have incoming offset set to 8, from bb0, and not 24, from bb1.


Repository:
  rL LLVM

https://reviews.llvm.org/D46671





More information about the llvm-commits mailing list