[PATCH] D45045: [DebugInfo] Generate debug information for labels.

Hsiangkai Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 1 08:09:48 PDT 2018


HsiangKai added a comment.

In https://reviews.llvm.org/D45045#1184313, @vext01 wrote:

> Looks like this was backed out (reverted) yesterday.
>
> I'm really interested in inserting DILabels from LLVM in my research project, so I hope it can be recovered.


You could apply it locally. In most cases, it works fine.

Currently, I still work on some problems when you use label in goto expression and you do some calculation on it under optimization.
Following is the test case I try to resolve the problem.

  int tab[9];
  
  void execute(unsigned short *oip, unsigned short *ip)
  {
    int x = 0;
    int *xp = tab;
  base:
    x++;
    if (x == 4)
      {
        *xp = 0;
        return;
      }
    *xp++ = ip - oip;
    goto *(&&base + *ip++);
  }
  
  int main()
  {
    unsigned short ip[10];
    int i;
    for (i = 0; i < 10; i++)
      ip[i] = 0;
    execute(ip, ip);
  
    return 0;
  }

If you do not use label in such complex way, I think you could apply it temporarily.


Repository:
  rL LLVM

https://reviews.llvm.org/D45045





More information about the cfe-commits mailing list