r317961 - [CUDA] Fix std::min on device side to return the min, not the max.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 10 17:25:44 PST 2017


Author: jlebar
Date: Fri Nov 10 17:25:44 2017
New Revision: 317961

URL: http://llvm.org/viewvc/llvm-project?rev=317961&view=rev
Log:
[CUDA] Fix std::min on device side to return the min, not the max.

Summary:
How embarrassing.

This is tested in the test-suite -- fix to come there in a separate
patch.

Reviewers: tra

Subscribers: sanjoy, cfe-commits

Differential Revision: https://reviews.llvm.org/D39817

Modified:
    cfe/trunk/lib/Headers/cuda_wrappers/algorithm

Modified: cfe/trunk/lib/Headers/cuda_wrappers/algorithm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/cuda_wrappers/algorithm?rev=317961&r1=317960&r2=317961&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/cuda_wrappers/algorithm (original)
+++ cfe/trunk/lib/Headers/cuda_wrappers/algorithm Fri Nov 10 17:25:44 2017
@@ -80,7 +80,7 @@ min(const __T &__a, const __T &__b, __Cm
 template <class __T>
 inline __device__ const __T &
 min(const __T &__a, const __T &__b) {
-  return __a < __b ? __b : __a;
+  return __a < __b ? __a : __b;
 }
 
 #ifdef _LIBCPP_END_NAMESPACE_STD




More information about the cfe-commits mailing list