-
Notifications
You must be signed in to change notification settings - Fork 0
Change getTgtMemIntrinsic interface with returning a pair #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
55c3ad2
d88808b
867b0d7
7e574c7
f2abced
e89d6ba
9f26e22
665ebae
766d8c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| //===- InterestingMemoryOperand.h -------------------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // This file defines InterestingMemoryOperand class that is used when getting | ||
| // the information of a memory reference instruction. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_ANALYSIS_INTERESTINGMEMORYOPERAND_H | ||
| #define LLVM_ANALYSIS_INTERESTINGMEMORYOPERAND_H | ||
|
|
||
| #include "llvm/IR/DataLayout.h" | ||
| #include "llvm/IR/Instruction.h" | ||
| #include "llvm/Support/TypeSize.h" | ||
|
|
||
| namespace llvm { | ||
| class InterestingMemoryOperand { | ||
| public: | ||
| Use *PtrUse; | ||
| bool IsWrite; | ||
| Type *OpType; | ||
| TypeSize TypeStoreSize = TypeSize::getFixed(0); | ||
| MaybeAlign Alignment; | ||
| // The mask Value, if we're looking at a masked load/store. | ||
| Value *MaybeMask; | ||
| // The EVL Value, if we're looking at a vp intrinsic. | ||
| Value *MaybeEVL; | ||
| // The Stride Value, if we're looking at a strided load/store. | ||
| Value *MaybeStride; | ||
|
|
||
| InterestingMemoryOperand(Instruction *I, unsigned OperandNo, bool IsWrite, | ||
| class Type *OpType, MaybeAlign Alignment, | ||
| Value *MaybeMask = nullptr, | ||
| Value *MaybeEVL = nullptr, | ||
| Value *MaybeStride = nullptr) | ||
| : IsWrite(IsWrite), OpType(OpType), Alignment(Alignment), | ||
| MaybeMask(MaybeMask), MaybeEVL(MaybeEVL), MaybeStride(MaybeStride) { | ||
| const DataLayout &DL = I->getDataLayout(); | ||
| TypeStoreSize = DL.getTypeStoreSizeInBits(OpType); | ||
| PtrUse = &I->getOperandUse(OperandNo); | ||
| } | ||
|
|
||
| Instruction *getInsn() { return cast<Instruction>(PtrUse->getUser()); } | ||
|
|
||
| Value *getPtr() { return PtrUse->get(); } | ||
| }; | ||
|
|
||
| } // namespace llvm | ||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1024,7 +1024,6 @@ bool PPCTTIImpl::getTgtMemIntrinsic(IntrinsicInst *Inst, | |
| default: | ||
| break; | ||
| } | ||
|
|
||
| return false; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please revert this change |
||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,8 +69,10 @@ class PPCTTIImpl final : public BasicTTIImplBase<PPCTTIImpl> { | |
| bool canSaveCmp(Loop *L, BranchInst **BI, ScalarEvolution *SE, LoopInfo *LI, | ||
| DominatorTree *DT, AssumptionCache *AC, | ||
| TargetLibraryInfo *LibInfo) const override; | ||
|
|
||
|
||
| bool getTgtMemIntrinsic(IntrinsicInst *Inst, | ||
| MemIntrinsicInfo &Info) const override; | ||
|
|
||
| void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, | ||
| TTI::UnrollingPreferences &UP, | ||
| OptimizationRemarkEmitter *ORE) const override; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -808,8 +808,9 @@ class EarlyCSE { | |
| : Inst(Inst) { | ||
| if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Inst)) { | ||
| IntrID = II->getIntrinsicID(); | ||
| if (TTI.getTgtMemIntrinsic(II, Info)) | ||
| if (TTI.getTgtMemIntrinsic(II, Info)) { | ||
|
||
| return; | ||
| } | ||
| if (isHandledNonTargetIntrinsic(IntrID)) { | ||
| switch (IntrID) { | ||
| case Intrinsic::masked_load: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1076,10 +1076,9 @@ static MemAccessTy getAccessType(const TargetTransformInfo &TTI, | |
| default: { | ||
| MemIntrinsicInfo IntrInfo; | ||
| if (TTI.getTgtMemIntrinsic(II, IntrInfo) && IntrInfo.PtrVal) { | ||
| AccessTy.AddrSpace | ||
| = IntrInfo.PtrVal->getType()->getPointerAddressSpace(); | ||
| AccessTy.AddrSpace = | ||
|
||
| IntrInfo.PtrVal->getType()->getPointerAddressSpace(); | ||
| } | ||
|
|
||
| break; | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert these formatting changes