tra marked an inline comment as done.

================
Comment at: lib/Sema/SemaCUDA.cpp:132-141
@@ -131,12 +131,12 @@
   // (d) HostDevice behavior depends on compilation mode.
   if (CallerTarget == CFT_HostDevice) {
     // Calling a function that matches compilation mode is OK.
     // Calling a function from the other side is frowned upon.
     if (getLangOpts().CUDAIsDevice)
-      return CalleeTarget == CFT_Device ? CFP_Fallback : QuestionableResult;
+      return CalleeTarget == CFT_Device ? CFP_SameSide : QuestionableResult;
     else
       return (CalleeTarget == CFT_Host || CalleeTarget == CFT_Global)
-                 ? CFP_Fallback
+                 ? CFP_SameSide
                  : QuestionableResult;
   }
 
----------------
jingyue wrote:
> Maybe a clearer way is to replace QuestionableResult with CFP_WrongSide in 
> this if block, and after this if block say
> 
> ```
> if (DisabletargetCallChecks && CFP_WrongSide)
>   return CFP_Never;
> ```
I've rearranged the code to make it easier to follow. I hope.

================
Comment at: lib/Sema/SemaOverload.cpp:8544
@@ +8543,3 @@
+        S.IdentifyCUDAPreference(Caller, Cand2.Function);
+    if (((CFP1 == Sema::CFP_SameSide || CFP1 == Sema::CFP_Native) &&
+         (CFP2 <= Sema::CFP_WrongSide)) ||
----------------
jingyue wrote:
> Why can't we just return `CFP1>CFP2`? What's a counter example for that? 
You can look at it this way -- if both callees are viable during compilation 
(i.e. we can generate code for both)  we want to use C++ overload resolution 
rules to pick best one (and can't return here). If one is viable and another is 
not, then the viable one always wins and that's what the check is for.

See template_vs_hd_function() in the test for example when we should not return 
here.


http://reviews.llvm.org/D16870



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to