[llvm] [Target][AMDGPU] Fix TSan error on AMDGPU Target. (PR #79529)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 16:47:23 PST 2024


================
@@ -112,11 +112,15 @@ bool AMDGPUResourceUsageAnalysis::runOnModule(Module &M) {
 
   // By default, for code object v5 and later, track only the minimum scratch
   // size
+  uint32_t AssumedStackSizeForDynamicSizeObjects =
+      clAssumedStackSizeForDynamicSizeObjects.getDefault().getValue();
+  uint32_t AssumedStackSizeForExternalCall =
+      clAssumedStackSizeForExternalCall.getDefault().getValue();
   if (AMDGPU::getAMDHSACodeObjectVersion(M) >= AMDGPU::AMDHSA_COV5 ||
       STI.getTargetTriple().getOS() == Triple::AMDPAL) {
-    if (!AssumedStackSizeForDynamicSizeObjects.getNumOccurrences())
+    if (!clAssumedStackSizeForDynamicSizeObjects.getNumOccurrences())
       AssumedStackSizeForDynamicSizeObjects = 0;
-    if (!AssumedStackSizeForExternalCall.getNumOccurrences())
+    if (!clAssumedStackSizeForExternalCall.getNumOccurrences())
----------------
kuhar wrote:

nit: I know this is existing code, but while we are at it, can we compare this `== 0` instead of abusing `!`

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


More information about the llvm-commits mailing list