diff options
Diffstat (limited to 'llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp')
-rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp b/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp index 9de8ee888b9..321323fb21c 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp @@ -444,9 +444,22 @@ static bool collectUsesWithPtrTypes(Value *Val, std::vector<Value*> &WorkList) { return false; if (StoreInst *SI = dyn_cast_or_null<StoreInst>(UseInst)) { + if (SI->isVolatile()) + return false; + // Reject if the stored value is not the pointer operand. if (SI->getPointerOperand() != Val) return false; + } else if (LoadInst *LI = dyn_cast_or_null<LoadInst>(UseInst)) { + if (LI->isVolatile()) + return false; + } else if (AtomicRMWInst *RMW = dyn_cast_or_null<AtomicRMWInst>(UseInst)) { + if (RMW->isVolatile()) + return false; + } else if (AtomicCmpXchgInst *CAS + = dyn_cast_or_null<AtomicCmpXchgInst>(UseInst)) { + if (CAS->isVolatile()) + return false; } if (!User->getType()->isPointerTy()) |