[llvm] [Attributor] Fix an issue that an access is skipped by mistake (PR #101862)
Shilei Tian via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 3 20:40:19 PDT 2024
https://github.com/shiltian created https://github.com/llvm/llvm-project/pull/101862
When we check if an access can be skipped, there is a case that an
inter-procedural interference access exists after a dominant write. Currently we
rely on `AAInterFnReachability` to tell if the access can be reachable. If it is
not, we can safely skip the access. However, it is based on an assumption that
the AA exists. It is possible that the AA doesn't exist. In this case, we can't
safely assume the acess can be skipped because we have to assume the access can
reach. This can happen when `AAInterFnReachability` is not in the allowed AA
list when creating the attributor, such as AMDGPUAttributor.
>From 70d02a359aeaca0e7e9f305834f48311ef324781 Mon Sep 17 00:00:00 2001
From: Shilei Tian <i at tianshilei.me>
Date: Sat, 3 Aug 2024 23:30:59 -0400
Subject: [PATCH] [Attributor] Fix an issue that an access is skipped by
mistake
When we check if an access can be skipped, there is a case that an
inter-procedural interference access exists after a dominant write. Currently we
rely on `AAInterFnReachability` to tell if the access can be reachable. If it is
not, we can safely skip the access. However, it is based on an assumption that
the AA exists. It is possible that the AA doesn't exist. In this case, we can't
safely assume the acess can be skipped because we have to assume the access can
reach. This can happen when `AAInterFnReachability` is not in the allowed AA
list when creating the attributor, such as AMDGPUAttributor.
---
llvm/lib/Transforms/IPO/AttributorAttributes.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index cd31c4be1c1da..1a551faec6dff 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -1331,7 +1331,7 @@ struct AAPointerInfoImpl
// itself either.
bool Inserted = ExclusionSet.insert(&I).second;
- if (!FnReachabilityAA ||
+ if (FnReachabilityAA &&
!FnReachabilityAA->instructionCanReach(
A, *LeastDominatingWriteInst,
*Acc.getRemoteInst()->getFunction(), &ExclusionSet))
More information about the llvm-commits
mailing list