@@ -94,26 +94,6 @@ unsigned llvm::ThreadPoolStrategy::compute_thread_count() const {
9494 return MaxThreadCount;
9595}
9696
97- Optional<ThreadPoolStrategy>
98- llvm::get_threadpool_strategy (StringRef Num, ThreadPoolStrategy Default) {
99- if (Num == " all" )
100- return llvm::hardware_concurrency ();
101- if (Num.empty ())
102- return Default;
103- unsigned V;
104- if (Num.getAsInteger (10 , V))
105- return None; // malformed 'Num' value
106- if (V == 0 )
107- return Default;
108-
109- // Do not take the Default into account. This effectively disables
110- // heavyweight_hardware_concurrency() if the user asks for any number of
111- // threads on the cmd-line.
112- ThreadPoolStrategy S = llvm::hardware_concurrency ();
113- S.ThreadsRequested = V;
114- return S;
115- }
116-
11797namespace {
11898struct SyncThreadInfo {
11999 void (*UserFn)(void *);
@@ -150,3 +130,23 @@ void llvm::llvm_execute_on_thread_async(
150130}
151131
152132#endif
133+
134+ Optional<ThreadPoolStrategy>
135+ llvm::get_threadpool_strategy (StringRef Num, ThreadPoolStrategy Default) {
136+ if (Num == " all" )
137+ return llvm::hardware_concurrency ();
138+ if (Num.empty ())
139+ return Default;
140+ unsigned V;
141+ if (Num.getAsInteger (10 , V))
142+ return None; // malformed 'Num' value
143+ if (V == 0 )
144+ return Default;
145+
146+ // Do not take the Default into account. This effectively disables
147+ // heavyweight_hardware_concurrency() if the user asks for any number of
148+ // threads on the cmd-line.
149+ ThreadPoolStrategy S = llvm::hardware_concurrency ();
150+ S.ThreadsRequested = V;
151+ return S;
152+ }
0 commit comments