[llvm] [Attributor] Add support for atomic operations in `AAAddressSpace` (PR #106927)
Sameer Sahasrabuddhe via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 4 18:55:08 PDT 2024
================
@@ -1084,10 +1084,15 @@ static bool runImpl(Module &M, AnalysisGetter &AG, TargetMachine &TM,
if (auto *LI = dyn_cast<LoadInst>(&I)) {
A.getOrCreateAAFor<AAAddressSpace>(
IRPosition::value(*LI->getPointerOperand()));
- }
- if (auto *SI = dyn_cast<StoreInst>(&I)) {
+ } else if (auto *SI = dyn_cast<StoreInst>(&I)) {
A.getOrCreateAAFor<AAAddressSpace>(
IRPosition::value(*SI->getPointerOperand()));
+ } else if (auto *AI = dyn_cast<AtomicRMWInst>(&I)) {
+ A.getOrCreateAAFor<AAAddressSpace>(
+ IRPosition::value(*AI->getPointerOperand()));
+ } else if (auto *CmpX = dyn_cast<AtomicCmpXchgInst>(&I)) {
+ A.getOrCreateAAFor<AAAddressSpace>(
+ IRPosition::value(*CmpX->getPointerOperand()));
----------------
ssahasra wrote:
This a non-blocking request, but all that copy-pasted code is really itchy. Would you consider adding ``getPointerOperand()`` to the ``Instruction`` class itself?
https://github.com/llvm/llvm-project/pull/106927
More information about the llvm-commits
mailing list