AMDGPU/SI: Don't promote alloca to vector for atomic load/store
Summary:
Don't promote alloca to vector for atomic load/store
Reviewer:
arsenm
Differential Revision:
https://reviews.llvm.org/D46085
llvm-svn: 332673
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp b/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
index 9264cb1..2f83e60 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
@@ -323,17 +323,19 @@
static bool canVectorizeInst(Instruction *Inst, User *User) {
switch (Inst->getOpcode()) {
case Instruction::Load: {
+ // Currently only handle the case where the Pointer Operand is a GEP.
+ // Also we could not vectorize volatile or atomic loads.
LoadInst *LI = cast<LoadInst>(Inst);
- // Currently only handle the case where the Pointer Operand is a GEP so check for that case.
- return isa<GetElementPtrInst>(LI->getPointerOperand()) && !LI->isVolatile();
+ return isa<GetElementPtrInst>(LI->getPointerOperand()) && LI->isSimple();
}
case Instruction::BitCast:
return true;
case Instruction::Store: {
// Must be the stored pointer operand, not a stored value, plus
// since it should be canonical form, the User should be a GEP.
+ // Also we could not vectorize volatile or atomic stores.
StoreInst *SI = cast<StoreInst>(Inst);
- return (SI->getPointerOperand() == User) && isa<GetElementPtrInst>(User) && !SI->isVolatile();
+ return (SI->getPointerOperand() == User) && isa<GetElementPtrInst>(User) && SI->isSimple();
}
default:
return false;