mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[ScalarizeMaskedMemIntrin] NFC: Pass args by reference
This commit is contained in:
parent
972a573aa5
commit
5d70260f30
@ -42,9 +42,6 @@ using namespace llvm;
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class ScalarizeMaskedMemIntrin : public FunctionPass {
|
class ScalarizeMaskedMemIntrin : public FunctionPass {
|
||||||
const TargetTransformInfo *TTI = nullptr;
|
|
||||||
const DataLayout *DL = nullptr;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static char ID; // Pass identification, replacement for typeid
|
static char ID; // Pass identification, replacement for typeid
|
||||||
|
|
||||||
@ -66,10 +63,10 @@ public:
|
|||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
static bool optimizeBlock(BasicBlock &BB, bool &ModifiedDT,
|
static bool optimizeBlock(BasicBlock &BB, bool &ModifiedDT,
|
||||||
const TargetTransformInfo *TTI, const DataLayout *DL);
|
const TargetTransformInfo &TTI, const DataLayout &DL);
|
||||||
static bool optimizeCallInst(CallInst *CI, bool &ModifiedDT,
|
static bool optimizeCallInst(CallInst *CI, bool &ModifiedDT,
|
||||||
const TargetTransformInfo *TTI,
|
const TargetTransformInfo &TTI,
|
||||||
const DataLayout *DL);
|
const DataLayout &DL);
|
||||||
|
|
||||||
char ScalarizeMaskedMemIntrin::ID = 0;
|
char ScalarizeMaskedMemIntrin::ID = 0;
|
||||||
|
|
||||||
@ -827,8 +824,8 @@ static void scalarizeMaskedCompressStore(CallInst *CI, bool &ModifiedDT) {
|
|||||||
bool ScalarizeMaskedMemIntrin::runOnFunction(Function &F) {
|
bool ScalarizeMaskedMemIntrin::runOnFunction(Function &F) {
|
||||||
bool EverMadeChange = false;
|
bool EverMadeChange = false;
|
||||||
|
|
||||||
TTI = &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F);
|
auto &TTI = getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F);
|
||||||
DL = &F.getParent()->getDataLayout();
|
auto &DL = F.getParent()->getDataLayout();
|
||||||
|
|
||||||
bool MadeChange = true;
|
bool MadeChange = true;
|
||||||
while (MadeChange) {
|
while (MadeChange) {
|
||||||
@ -850,8 +847,8 @@ bool ScalarizeMaskedMemIntrin::runOnFunction(Function &F) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool optimizeBlock(BasicBlock &BB, bool &ModifiedDT,
|
static bool optimizeBlock(BasicBlock &BB, bool &ModifiedDT,
|
||||||
const TargetTransformInfo *TTI,
|
const TargetTransformInfo &TTI,
|
||||||
const DataLayout *DL) {
|
const DataLayout &DL) {
|
||||||
bool MadeChange = false;
|
bool MadeChange = false;
|
||||||
|
|
||||||
BasicBlock::iterator CurInstIterator = BB.begin();
|
BasicBlock::iterator CurInstIterator = BB.begin();
|
||||||
@ -866,8 +863,8 @@ static bool optimizeBlock(BasicBlock &BB, bool &ModifiedDT,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool optimizeCallInst(CallInst *CI, bool &ModifiedDT,
|
static bool optimizeCallInst(CallInst *CI, bool &ModifiedDT,
|
||||||
const TargetTransformInfo *TTI,
|
const TargetTransformInfo &TTI,
|
||||||
const DataLayout *DL) {
|
const DataLayout &DL) {
|
||||||
IntrinsicInst *II = dyn_cast<IntrinsicInst>(CI);
|
IntrinsicInst *II = dyn_cast<IntrinsicInst>(CI);
|
||||||
if (II) {
|
if (II) {
|
||||||
// The scalarization code below does not work for scalable vectors.
|
// The scalarization code below does not work for scalable vectors.
|
||||||
@ -881,14 +878,14 @@ static bool optimizeCallInst(CallInst *CI, bool &ModifiedDT,
|
|||||||
break;
|
break;
|
||||||
case Intrinsic::masked_load:
|
case Intrinsic::masked_load:
|
||||||
// Scalarize unsupported vector masked load
|
// Scalarize unsupported vector masked load
|
||||||
if (TTI->isLegalMaskedLoad(
|
if (TTI.isLegalMaskedLoad(
|
||||||
CI->getType(),
|
CI->getType(),
|
||||||
cast<ConstantInt>(CI->getArgOperand(1))->getAlignValue()))
|
cast<ConstantInt>(CI->getArgOperand(1))->getAlignValue()))
|
||||||
return false;
|
return false;
|
||||||
scalarizeMaskedLoad(CI, ModifiedDT);
|
scalarizeMaskedLoad(CI, ModifiedDT);
|
||||||
return true;
|
return true;
|
||||||
case Intrinsic::masked_store:
|
case Intrinsic::masked_store:
|
||||||
if (TTI->isLegalMaskedStore(
|
if (TTI.isLegalMaskedStore(
|
||||||
CI->getArgOperand(0)->getType(),
|
CI->getArgOperand(0)->getType(),
|
||||||
cast<ConstantInt>(CI->getArgOperand(2))->getAlignValue()))
|
cast<ConstantInt>(CI->getArgOperand(2))->getAlignValue()))
|
||||||
return false;
|
return false;
|
||||||
@ -899,8 +896,8 @@ static bool optimizeCallInst(CallInst *CI, bool &ModifiedDT,
|
|||||||
cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue();
|
cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue();
|
||||||
Type *LoadTy = CI->getType();
|
Type *LoadTy = CI->getType();
|
||||||
Align Alignment =
|
Align Alignment =
|
||||||
DL->getValueOrABITypeAlignment(MaybeAlign(AlignmentInt), LoadTy);
|
DL.getValueOrABITypeAlignment(MaybeAlign(AlignmentInt), LoadTy);
|
||||||
if (TTI->isLegalMaskedGather(LoadTy, Alignment))
|
if (TTI.isLegalMaskedGather(LoadTy, Alignment))
|
||||||
return false;
|
return false;
|
||||||
scalarizeMaskedGather(CI, ModifiedDT);
|
scalarizeMaskedGather(CI, ModifiedDT);
|
||||||
return true;
|
return true;
|
||||||
@ -910,19 +907,19 @@ static bool optimizeCallInst(CallInst *CI, bool &ModifiedDT,
|
|||||||
cast<ConstantInt>(CI->getArgOperand(2))->getZExtValue();
|
cast<ConstantInt>(CI->getArgOperand(2))->getZExtValue();
|
||||||
Type *StoreTy = CI->getArgOperand(0)->getType();
|
Type *StoreTy = CI->getArgOperand(0)->getType();
|
||||||
Align Alignment =
|
Align Alignment =
|
||||||
DL->getValueOrABITypeAlignment(MaybeAlign(AlignmentInt), StoreTy);
|
DL.getValueOrABITypeAlignment(MaybeAlign(AlignmentInt), StoreTy);
|
||||||
if (TTI->isLegalMaskedScatter(StoreTy, Alignment))
|
if (TTI.isLegalMaskedScatter(StoreTy, Alignment))
|
||||||
return false;
|
return false;
|
||||||
scalarizeMaskedScatter(CI, ModifiedDT);
|
scalarizeMaskedScatter(CI, ModifiedDT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case Intrinsic::masked_expandload:
|
case Intrinsic::masked_expandload:
|
||||||
if (TTI->isLegalMaskedExpandLoad(CI->getType()))
|
if (TTI.isLegalMaskedExpandLoad(CI->getType()))
|
||||||
return false;
|
return false;
|
||||||
scalarizeMaskedExpandLoad(CI, ModifiedDT);
|
scalarizeMaskedExpandLoad(CI, ModifiedDT);
|
||||||
return true;
|
return true;
|
||||||
case Intrinsic::masked_compressstore:
|
case Intrinsic::masked_compressstore:
|
||||||
if (TTI->isLegalMaskedCompressStore(CI->getArgOperand(0)->getType()))
|
if (TTI.isLegalMaskedCompressStore(CI->getArgOperand(0)->getType()))
|
||||||
return false;
|
return false;
|
||||||
scalarizeMaskedCompressStore(CI, ModifiedDT);
|
scalarizeMaskedCompressStore(CI, ModifiedDT);
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user