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

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 16 23:18:10 PST 2016


jlebar marked 2 inline comments as done.

================
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;
----------------
jingyue wrote:
> 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.
> Maybe this reads better

Sure, I think that's better; combined the if statements.

> What happens if CS.getCalledFunction() == nullptr?

We do a lookup of nullptr in the map, which is fine.  (This is covered by a testcase -- I hope. :)


http://reviews.llvm.org/D17317





More information about the llvm-commits mailing list