[PATCH] D156835: CoroFrame: Rework SuspendCrossingInfo analysis

witstorm via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 19:55:11 PDT 2023


witstorm95 added a comment.

In D156835#4552147 <https://reviews.llvm.org/D156835#4552147>, @MatzeB wrote:

> Publishing an alternative to D154695 <https://reviews.llvm.org/D154695> here. I got somewhat nerd-snipet yesterday in trying to prove that RPOs work perfectly fine and lead to clean code...

It work well at testcase in https://github.com/llvm/llvm-project/issues/62348. But if we add some loops to generate more complex CFG, It takes a long time on suspendCrossingInfo analysis. The modification about gen2.cpp as follow,

  #include <cassert>
  #include <cstdio>
  #include <cstdlib>
  
  int main(int argc, char **argv) {
    assert(argc == 2);
    int n = atoi(argv[1]);
    printf("#include <cstdio>\n");
    printf("#include <vector>\n");
    printf("#include \"task.h\"\n");
    printf("extern bool count(int);\n");
    printf("task t() {\n");
    printf("std::vector<int> v(%d);\n", n);
    printf("int val = 0;\n");
    printf("for (int i = 0; i < %d; ++i) {;\n", n);
    for (int i = 1; i <= n; i++) printf("if (count(v[i])) val++;\n");
    printf("}\n");
    printf("printf(\"%%d\\n\", val);\n");
    printf("co_return;\n");
    printf("}\n");
    return 0;
  }

It takes 9 mins when n = 2000.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156835



More information about the llvm-commits mailing list