Skip to content

Commit 38e5322

Browse files
committed
[LSR] Add masked load and store handling
This teaches Loop Strength Reduction the details about masked load and store address operands, so that it can have a better time optimising them as it would for normal loads and stores. Differential Revision: https://reviews.llvm.org/D75371
1 parent e98ef0a commit 38e5322

File tree

2 files changed

+391
-2
lines changed

2 files changed

+391
-2
lines changed

llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,9 +809,14 @@ static bool isAddressUse(const TargetTransformInfo &TTI,
809809
switch (II->getIntrinsicID()) {
810810
case Intrinsic::memset:
811811
case Intrinsic::prefetch:
812+
case Intrinsic::masked_load:
812813
if (II->getArgOperand(0) == OperandVal)
813814
isAddress = true;
814815
break;
816+
case Intrinsic::masked_store:
817+
if (II->getArgOperand(1) == OperandVal)
818+
isAddress = true;
819+
break;
815820
case Intrinsic::memmove:
816821
case Intrinsic::memcpy:
817822
if (II->getArgOperand(0) == OperandVal ||
@@ -861,6 +866,15 @@ static MemAccessTy getAccessType(const TargetTransformInfo &TTI,
861866
AccessTy.AddrSpace = OperandVal->getType()->getPointerAddressSpace();
862867
AccessTy.MemTy = OperandVal->getType();
863868
break;
869+
case Intrinsic::masked_load:
870+
AccessTy.AddrSpace =
871+
II->getArgOperand(0)->getType()->getPointerAddressSpace();
872+
break;
873+
case Intrinsic::masked_store:
874+
AccessTy.MemTy = II->getOperand(0)->getType();
875+
AccessTy.AddrSpace =
876+
II->getArgOperand(1)->getType()->getPointerAddressSpace();
877+
break;
864878
default: {
865879
MemIntrinsicInfo IntrInfo;
866880
if (TTI.getTgtMemIntrinsic(II, IntrInfo) && IntrInfo.PtrVal) {

0 commit comments

Comments
 (0)