[PATCH] D17317: [attrs] Handle convergent CallSites.

Jingyue Wu via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 16 22:02:17 PST 2016


jingyue added inline comments.

================
Comment at: lib/Transforms/IPO/FunctionAttrs.cpp:955-958
@@ +954,6 @@
+      CallSite CS(&I);
+      if (!CS || !CS.isConvergent())
+        continue;
+      // Bail if is CS a call to a function not in the SCC.
+      if (SCCNodes.count(CS.getCalledFunction()) == 0)
+        return false;
----------------
Maybe this reads better
```
if (CS && CS.isConvergent()) {
  if (SCCNodes.count(CS.getCalledFunction()) == 0)
    return false;
}
```
This reads exactly like your comment -- if CS is a convergent call to a function not in SCC.

================
Comment at: lib/Transforms/IPO/FunctionAttrs.cpp:958
@@ +957,3 @@
+      // Bail if is CS a call to a function not in the SCC.
+      if (SCCNodes.count(CS.getCalledFunction()) == 0)
+        return false;
----------------
What happens if `CS.getCalledFunction() == nullptr`? i.e. `CS` calls a function pointer. 


http://reviews.llvm.org/D17317





More information about the llvm-commits mailing list