[MemAccInst] Introduce the '->' operator and remove the simple wrapper functions. NFC

llvm-svn: 261994
This commit is contained in:
Hongbin Zheng 2016-02-26 09:47:11 +00:00
parent f43e9925ee
commit f3d6612c0a
3 changed files with 9 additions and 19 deletions

View File

@ -150,26 +150,16 @@ public:
return *this;
}
llvm::Instruction *get() const {
assert(I && "Unexpected nullptr!");
return I;
}
operator llvm::Instruction *() const { return asInstruction(); }
llvm::Instruction *operator->() const { return get(); }
explicit operator bool() const { return isInstruction(); }
bool operator!() const { return isNull(); }
llvm::Value *getOperand(unsigned i) const { return I->getOperand(i); }
llvm::BasicBlock *getParent() const { return I->getParent(); }
llvm::LLVMContext &getContext() const { return I->getContext(); }
void getAAMetadata(llvm::AAMDNodes &N, bool Merge = false) const {
I->getAAMetadata(N, Merge);
}
/// @brief Get the debug location of this instruction.
///
/// @returns The debug location of this instruction.
const llvm::DebugLoc &getDebugLoc() const {
if (I)
return I->getDebugLoc();
llvm_unreachable("Operation not supported on nullptr");
}
llvm::Value *getValueOperand() const {
if (isLoad())
return asLoad();

View File

@ -942,7 +942,7 @@ bool ScopDetection::isValidAccess(Instruction *Inst, const SCEV *AF,
bool ScopDetection::isValidMemoryAccess(MemAccInst Inst,
DetectionContext &Context) const {
Value *Ptr = Inst.getPointerOperand();
Loop *L = LI->getLoopFor(Inst.getParent());
Loop *L = LI->getLoopFor(Inst->getParent());
const SCEV *AccessFunction = SE->getSCEVAtScope(Ptr, L);
const SCEVUnknown *BasePointer;

View File

@ -3926,7 +3926,7 @@ bool ScopInfo::buildAccessMultiDimParam(
cast<SCEVConstant>(Sizes.back())->getAPInt().getSExtValue();
Sizes.pop_back();
if (ElementSize != DelinearizedSize)
scop->invalidate(DELINEARIZATION, Inst.getDebugLoc());
scop->invalidate(DELINEARIZATION, Inst->getDebugLoc());
addArrayAccess(Inst, Type, BasePointer->getValue(), ElementType, true,
AccItr->second.DelinearizedSubscripts, Sizes, Val);
@ -4218,7 +4218,7 @@ void ScopInfo::addArrayAccess(MemAccInst MemAccInst,
ArrayRef<const SCEV *> Sizes,
Value *AccessValue) {
ArrayBasePointers.insert(BaseAddress);
addMemoryAccess(MemAccInst.getParent(), MemAccInst, AccType, BaseAddress,
addMemoryAccess(MemAccInst->getParent(), MemAccInst, AccType, BaseAddress,
ElementType, IsAffine, AccessValue, Subscripts, Sizes,
ScopArrayInfo::MK_Array);
}