[compiler-rt] [scudo] Condition variable can be disabled by setting the flag to off (PR #77532)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 9 14:16:43 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: None (ChiaHungDuan)

<details>
<summary>Changes</summary>

To enable the condition variable, you have to define both UseConditionVariable and the ConditionVariableT. Otherwise, it'll be disabled. However, you may want to disable the condition variable by setting UseConditionVariable=false, for example, while measuring the performance and you want to turn it off temporarily. Instead of requiring the removal of the variable, examining its value makes more sense.

---
Full diff: https://github.com/llvm/llvm-project/pull/77532.diff


1 Files Affected:

- (modified) compiler-rt/lib/scudo/standalone/condition_variable.h (+1-1) 


``````````diff
diff --git a/compiler-rt/lib/scudo/standalone/condition_variable.h b/compiler-rt/lib/scudo/standalone/condition_variable.h
index 549f6e9f787bad..4afebdc9d04c2c 100644
--- a/compiler-rt/lib/scudo/standalone/condition_variable.h
+++ b/compiler-rt/lib/scudo/standalone/condition_variable.h
@@ -51,7 +51,7 @@ struct ConditionVariableState {
 
 template <typename Config>
 struct ConditionVariableState<Config, decltype(Config::UseConditionVariable)> {
-  static constexpr bool enabled() { return true; }
+  static constexpr bool enabled() { return Config::UseConditionVariable; }
   using ConditionVariableT = typename Config::ConditionVariableT;
 };
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/77532


More information about the llvm-commits mailing list