diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2021-02-16 20:13:02 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2021-02-16 20:13:02 +0000 |
| commit | b60736ec1405bb0a8dd40989f67ef4c93da068ab (patch) | |
| tree | 5c43fbb7c9fc45f0f87e0e6795a86267dbd12f9d /llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp | |
| parent | cfca06d7963fa0909f90483b42a6d7d194d01e08 (diff) | |
Diffstat (limited to 'llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp b/llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp index 9c3d96de6d68..e2aafa25142e 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp @@ -43,35 +43,16 @@ #include "AMDGPU.h" #include "Utils/AMDGPUBaseInfo.h" -#include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallSet.h" -#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/MemoryDependenceAnalysis.h" -#include "llvm/Analysis/MemoryLocation.h" -#include "llvm/IR/Argument.h" -#include "llvm/IR/Attributes.h" -#include "llvm/IR/BasicBlock.h" -#include "llvm/IR/Constants.h" -#include "llvm/IR/DataLayout.h" -#include "llvm/IR/DerivedTypes.h" -#include "llvm/IR/Function.h" #include "llvm/IR/IRBuilder.h" #include "llvm/IR/Instructions.h" -#include "llvm/IR/Module.h" -#include "llvm/IR/Type.h" -#include "llvm/IR/Use.h" -#include "llvm/IR/User.h" -#include "llvm/IR/Value.h" #include "llvm/InitializePasses.h" #include "llvm/Pass.h" -#include "llvm/Support/Casting.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" -#include <cassert> -#include <utility> #define DEBUG_TYPE "amdgpu-rewrite-out-arguments" @@ -303,8 +284,8 @@ bool AMDGPURewriteOutArguments::runOnFunction(Function &F) { for (ReturnInst *RI : Returns) { BasicBlock *BB = RI->getParent(); - MemDepResult Q = MDA->getPointerDependencyFrom(MemoryLocation(OutArg), - true, BB->end(), BB, RI); + MemDepResult Q = MDA->getPointerDependencyFrom( + MemoryLocation::getBeforeOrAfter(OutArg), true, BB->end(), BB, RI); StoreInst *SI = nullptr; if (Q.isDef()) SI = dyn_cast<StoreInst>(Q.getInst()); @@ -325,9 +306,10 @@ bool AMDGPURewriteOutArguments::runOnFunction(Function &F) { Value *ReplVal = Store.second->getValueOperand(); auto &ValVec = Replacements[Store.first]; - if (llvm::find_if(ValVec, - [OutArg](const std::pair<Argument *, Value *> &Entry) { - return Entry.first == OutArg;}) != ValVec.end()) { + if (llvm::any_of(ValVec, + [OutArg](const std::pair<Argument *, Value *> &Entry) { + return Entry.first == OutArg; + })) { LLVM_DEBUG(dbgs() << "Saw multiple out arg stores" << *OutArg << '\n'); // It is possible to see stores to the same argument multiple times, @@ -408,8 +390,7 @@ bool AMDGPURewriteOutArguments::runOnFunction(Function &F) { if (DL->getTypeSizeInBits(EffectiveEltTy) != DL->getTypeSizeInBits(Val->getType())) { assert(isVec3ToVec4Shuffle(EffectiveEltTy, Val->getType())); - Val = B.CreateShuffleVector(Val, UndefValue::get(Val->getType()), - ArrayRef<int>{0, 1, 2}); + Val = B.CreateShuffleVector(Val, ArrayRef<int>{0, 1, 2}); } Val = B.CreateBitCast(Val, EffectiveEltTy); |
