[PATCH] D78341: Change callbr to only define its output SSA variable on the normal path, not the indirect targets.

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 14:05:19 PDT 2020


nickdesaulniers added a comment.

In D78341#1989625 <https://reviews.llvm.org/D78341#1989625>, @efriedma wrote:

> > I'm more concerned now about what we should do in the front end for these cases
>
> In the frontend, it should be impossible for the normal destination to be the same as an indirect destination.  Even if there's a label immediately after the asm goto, we should create an extra basic block between the asm goto and the label to emit whatever stores etc. are necessary.


Ah, sorry, my use of `these cases` was ambiguous.  I was not referring to the case you were describing of the indirect target and fallthrough being the same `BasicBlock` at the IR level.

I was asking about the C code from the Linux kernel that now crashes LLVM (which maybe is better than a failed assert) with this patch applied:

  int futex_lock_pi_atomic(void) {
    int d;
    asm goto("" : "=r"(d) : : : e);
  e:
    return d;
  }

Which indeed does have a basic block inserted by the IR, and a PHI thanks to James' patch, but produces crashes when compiling the Linux kernel.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78341/new/

https://reviews.llvm.org/D78341





More information about the llvm-commits mailing list