aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/ADT/Statistic.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/llvm/ADT/Statistic.h b/include/llvm/ADT/Statistic.h
index 9bbda986a8..b8a1a2f5c4 100644
--- a/include/llvm/ADT/Statistic.h
+++ b/include/llvm/ADT/Statistic.h
@@ -84,11 +84,13 @@ public:
}
const Statistic &operator+=(const unsigned &V) {
+ if (!V) return *this;
sys::AtomicAdd(&Value, V);
return init();
}
const Statistic &operator-=(const unsigned &V) {
+ if (!V) return *this;
sys::AtomicAdd(&Value, -V);
return init();
}