[PATCH] D64101: [LoopUnroll] fix cloning callbr

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 17:17:19 PDT 2019


efriedma added a comment.

The question is whether something like the following is legal:

  void bar(void) {
      long temp = 0;
      #pragma GCC unroll 3
      for (int j = 0; j < 3; ++j) {
          asm goto("lea %l2(%%rip), %%rax\n"
                   "cmp $0, %0\n"
                   "jne 1f\n"
                   "mov %%rax, %0\n"
                   "1:\n"
                   "jmp *%0\n" :: "m"(temp), "r"(j) :"memory","rax": baz);
          baz:;
      }
  }
  int main() { bar(); }

I guess the answer is that no, it isn't legal, given gcc's behavior.  But there's nothing in LangRef that forbids it... we need some rule that ties the value passed to the "X" constraint to the actual successor.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64101





More information about the llvm-commits mailing list