[flang] Rewrite test for CPU_TIME
authorDiana Picus <diana.picus@linaro.org>
Fri, 18 Jun 2021 09:04:01 +0000 (09:04 +0000)
committerDiana Picus <diana.picus@linaro.org>
Fri, 18 Jun 2021 09:12:24 +0000 (09:12 +0000)
commit4498137bd7857c07921b4cd6313baac62ead24e2
treee8292b36997bffce7408d3296260a1573e3dbfa7
parenta740b707d1937621dcf56579001bcad87b81724f
[flang] Rewrite test for CPU_TIME

Don't rely on volatile writes to keep the CPU busy - it seems MSVC
optimizes them out, so we don't get different values for 'start' and
'end' on Windows. Rewrite the test to loop until we get a different
value for 'end'.

Fix suggested by Michael Kruse in
https://reviews.llvm.org/rG57e85622bbdb2eb18cc03df2ea457019c58f6912#inline-6002

Committing to fix the Windows buildbot, post-commit comments welcome!
flang/unittests/RuntimeGTest/Time.cpp