From f3d6612c0a0b0337e270cbab29521f3aed959f8f Mon Sep 17 00:00:00 2001 From: Hongbin Zheng Date: Fri, 26 Feb 2016 09:47:11 +0000 Subject: [PATCH] [MemAccInst] Introduce the '->' operator and remove the simple wrapper functions. NFC llvm-svn: 261994 --- polly/include/polly/Support/ScopHelper.h | 22 ++++++---------------- polly/lib/Analysis/ScopDetection.cpp | 2 +- polly/lib/Analysis/ScopInfo.cpp | 4 ++-- 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/polly/include/polly/Support/ScopHelper.h b/polly/include/polly/Support/ScopHelper.h index 371fa41..aa1a662 100644 --- a/polly/include/polly/Support/ScopHelper.h +++ b/polly/include/polly/Support/ScopHelper.h @@ -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(); diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index a8833f1..2046a90 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -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; diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index eeed801..bb62f5c 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -3926,7 +3926,7 @@ bool ScopInfo::buildAccessMultiDimParam( cast(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 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); } -- 2.7.4