Commits

Mark Lacey committed b21a9e7fd0d
Try to ensure we generate unique trap locations. In 2e3c0b6, code was added to emit unique trap blocks for each cond_fail, in order to make post-mortem debugging simpler (e.g. stack traces have correct line/column information for the trapping location, and it's easy to trace back to the specific jump that reaches the trap). We didn't, however, do anything to ensure that LLVM wouldn't merge these back together again. This is an attempt to do exactly that, after seeing BranchFolding in the code generator merging traps into a single block. The idea here is to emit empty inline asm strings marked as side-effecting, and taking a unique integer argument. These come before the trap call, so they should block any valid attempt at merging the blocks back together. Ideally trap would take an argument which uniquely identifies it, but that isn't possible today. This solution is potentially brittle in that in theory LLVM could still merge the trap/unreachable and then branch to those after the unique asm calls. We cannot fix that by putting another asm call after the trap, because LLVM's CFG simplification will delete code after a trap. rdar://problem/25216969