[LLVMdev] [WinEH] Cloning blocks that reference non-cloned PHI nodes

Kaylor, Andrew andrew.kaylor at intel.com
Fri Apr 10 15:45:35 PDT 2015


Hi Reid and David,

I just wanted to give you a heads up that I'm currently working on a problem where the WinEHPrepare outlining code stumbles and asserts while cloning code that references extracted landing pad values via PHI nodes that are in intermediate blocks that aren't being cloned.  The test I'm looking at fails with an assertion claiming that llvm.eh.begincatch was called twice inside a handler.

I have an idea for how to address this (giving the cloning director a chance to replace operands before an instruction is remapped).  I'll put something up for review as soon as I have it working.  In the mean time I wanted to make sure you weren't working on the same problem.

I'm seeing it with some C++ EH tests I'm working on, but I think it may be possible for it to happen with SEH cleanup.

If you're curious, here's a reproducer.

int main(void) {
  try {
    try {
      throw 'a';
    } catch (char c) {
      printf("%c\n", c);
    }
    throw 1;
  } catch(int x) {
    printf("%d\n", x);
  } catch(...) {
    printf("...\n");
  }

  try {
    try {
      throw 'b';
    } catch (char c) {
      printf("%c\n", c);
    }
    throw 2;
  } catch(int x) {
    printf("%d\n", x);
  } catch (char c) {
    printf("%c\n", c);
  } catch(...) {
    printf("...\n");
  }
  return 0;
}

-Andy

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150410/bd114cbc/attachment.html>


More information about the llvm-dev mailing list