[PATCH] D58388: [OpenCL] Simplify LLVM IR generated for OpenCL blocks
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 20 02:41:03 PST 2019
Anastasia added inline comments.
================
Comment at: lib/CodeGen/CGBlocks.cpp:1275
+ // We *can* call the block directly unless it is a function argument.
+ if (!isa<ParmVarDecl>(E->getCalleeDecl()))
+ Func = CGM.getOpenCLRuntime().getInvokeFunction(E->getCallee());
----------------
I think it's reasonable enough... if we restrict blocks as parameters in the spec later it should be easy enough to modify this code.
================
Comment at: lib/CodeGen/CGOpenCLRuntime.cpp:131
+static const BlockExpr *getBlockExpr(const Expr *E) {
+ if (auto Cast = dyn_cast<CastExpr>(E)) {
+ E = Cast->getSubExpr();
----------------
Btw, does this handle the case when we assign a variable multiple time? I was just wondering if we need a loop somewhere?
I.e. does something like this work now:
```
typedef void (^bl_t)(local void *);
bl_t a = ...;
bl_t b = a;
bl_t c = b;
c();
enqueue_kernel(... c, ...);
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58388/new/
https://reviews.llvm.org/D58388
More information about the cfe-commits
mailing list